Text w/ Dynamic Prompts
Wildcard prompts inside the Sage ecosystem
- str
If you've used dynamic prompts on A1111 or the wildcard system in ComfyUI, you know the drill: write __category__ in your text, and the node picks a random value from a file of options - __pose__ might become "standing" one run and "crouching" the next. This node brings that to the Sage Utils pack, reading your wildcard files from Sage's own wildcards directory and expanding them with the same dynamicprompts library that powers the wider ecosystem.
How it works
You feed str_input (text containing __wildcard__ placeholders), plus a seed for reproducibility and a clean toggle. The node loads your wildcard files from the Sage wildcards directory, runs the text through the dynamic prompts generator with your seed, and outputs the expanded result as str. Set the same seed and you get the same expansion - that's the reproducibility feature, and it's the thing that makes wildcards usable in real workflow development instead of pure chaos. The optional prefix and suffix inputs are wrapped around the text before expansion, so they're part of what the generator sees.
The clean toggle (default off) post-processes the result to remove stray whitespace and formatting junk, which is worth switching on once you're generating for actual use rather than experimenting.
Where the wildcard files live
This is the part that trips people up: the pack reads from its own wildcards directory under the Sage user folder - comfyui/user/default/SageUtils/wildcards/ - not necessarily the standard ComfyUI wildcards folder your other wildcard nodes use. You drop a .txt file named pose.txt in there, write __pose__, and the node picks a random line from it. The pack's Prompt Builder tab (its tag-based UI) shares this same directory, so files you create for one feed the other.
Why use this over the built-in options
ComfyUI's core already has wildcard support these days, so this node is mostly about ecosystem fit: it shares Sage's wildcard directory with the Prompt Builder, it seeds exactly like the rest of the pack, and it's the same library A1111's dynamic prompts used, so behavior is predictable. It's also the node that justifies the pack's only pip dependency - dynamicprompts is installed specifically for this.
Installing it
Sage Utils via ComfyUI Manager (search Sage Utils) or:
cd ComfyUI/custom_nodes
git clone https://github.com/arcum42/ComfyUI_SageUtils
cd ComfyUI_SageUtils
pip install -r requirements.txt
Restart ComfyUI. If you don't run pip install -r requirements.txt, this node (and the pack) may fail on import - dynamicprompts is required, and Manager normally handles it for you.
The gotchas
Two things to remember: the seed field is the entire difference between "same output" and "new output," so if you're batching variations you'll want the seed wired to a changing value. And if a wildcard name doesn't expand, check the file is in Sage's directory with the exact name, not the ComfyUI-default one - most "it's not working" reports for this node are a wildcard file in the wrong folder.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| str_input | STRING | Text containing dynamic prompt wildcards. | |
| seed | INT | 00–4294967295 | Seed for wildcard generation. |
| clean | BOOLEAN | false | Remove unwanted whitespace or formatting after prompt generation. |
| prefixopt | STRING | Text to prepend before dynamic prompt expansion. | |
| suffixopt | STRING | Text to append after dynamic prompt expansion. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| str | STRING | Output value for str_output. |