Prompt Preset Selector (Folder, Wildcard)
Point this at a folder of prompt files and stop merging by hand
- text
- preset_list
- selected_info
There's a moment in every ComfyUI prompt library's life where it outgrows single files. You start with one styles.txt, then camera angles, then lighting, then a character list with subfolders and backups - and the "one file, one dropdown" preset nodes start to hurt. The Folder version of Prompt Preset Selector is the fix: point it at any folder on disk, and it recursively swallows every .txt, .yaml, and .yml under it, tags each line with its path so nothing collides, and layers the usual filters and wildcards on top. It's a text-plumbing node, not a model thing - no downloads, no API keys, nothing touches the GPU. It just quietly does the boring, error-prone job of assembling a prompt pool for you.
How it works
On every run the node walks folder_path with a recursive glob, so subfolders count - a real upgrade over the single-file selector. Every line gets prefixed with the path relative to your folder, so colors.txt: red and sub/colors.txt: crimson stay distinct instead of fighting for the same spot. Files load in alphabetical order of relative path, which keeps preset_index stable between runs as long as your folder doesn't change. And because files are reloaded fresh each execution, editing a preset mid-batch just works - no restart, no refresh ritual.
Full wildcard syntax is on board: {red|blue|green} choices (nestable), __filename__ to pull a random line from another file, and {__key__|__key__} to reference YAML keys - including keys in other files, since the folder pool is treated as one merged set.
The inputs that matter
Most of these are shared across the whole pack, so learn them once:
folder_path- the one that does all the work. Any absolute path, subfolders included.exclude_pattern- comma- or newline-separated glob patterns for skipping backups and drafts.keyword+keyword_mode- filter the pool.OFFuses everything,ANDrequires all keywords,ORmatches any. Exclude with a minus:front -widemeans "has front, not wide" (and it's-wide, no space after the dash).selection_mode-Manual(driven bypreset_index),Sequential,Sequential (continue), orRandom(seeded, so reproducible).enable_wildcard- defaulttrue, and it should stay there unless you want{A|B|C}to come out as literal text.
Three outputs: text (the winner - wire it into your positive or negative prompt), preset_list (a numbered list so you can find the index you want), and selected_info (a log line saying what got picked and why). If nothing matches, text is an empty string - deliberately, not an error - and selected_info explains itself. That's the first output to check when a batch comes back blank.
Install
ComfyUI Manager has it under "Prompt Preset Selector", or:
cd ComfyUI/custom_nodes
git clone https://github.com/shin131002/ComfyUI-Prompt-Preset-Selector.git
# only needed for YAML files, and usually already installed:
pip install pyyaml
Then restart ComfyUI. That's the whole install - no model files, no heavy dependencies. PyYAML is the only extra and the node just warns if it's missing. It'll also happily read from Impact Pack's wildcards/ folder if you have that installed.
Where people get burned
Three traps, all documented in the README and all worth internalizing:
*crosses/. Because exclude patterns use Python'sfnmatch,*.txtexcludes files in subfolders too - unlike a shell glob where*stops at a directory separator. There's currently no clean way to exclude only the top-level.txtfiles.- Exclude also matches the bare file name.
a.txtcatchessub/a.txtas well. To kill just the subfolder copy, write the full relative path:sub/a.txt. - Indices shift.
preset_indexnumbers the filtered list, so changing the keyword, or dropping a file into the folder, renumbers everything. Scope with a keyword prefix likecolors.txt:to pin results to one file.
Sequential (continue) also forgets its position the moment you reload the workflow - it only persists during a live session. And before you build a big library on it: the author ships with an explicit "no individual support" disclaimer (it's MIT, so forking is the intended fix). It's a genuinely handy utility - just don't expect a helpdesk.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| exclude_pattern | STRING | — | |
| keyword | STRING | — | |
| keyword_mode | COMBO | OFF | 3 options: OFF, AND, OR |
| selection_mode | COMBO | Manual | 4 options: Manual, Sequential, Sequential (continue), Random |
| preset_index | INT | 00–9999 | — |
| seed | INT | 00–18446744073709550000 | — |
| enable_wildcard | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| preset_list | STRING | — |
| selected_info | STRING | — |