Nodes/SAX Bridge/SAX Prompt
ComfyUI Node

SAX Prompt

Wildcards, LoRA tags, and BREAK in one node — SAX Prompt

By so16tm·Created 6 months ago·Updated 3 months ago· 0
SAX Prompt
  • pipe
  • PIPE
  • POPULATED_TEXT
wildcard_text
select_to_add_lora
select_to_add_wildcard

SAX Prompt is the node that turns a boring prompt box into a machine. It does three jobs that would normally take a small constellation of nodes: it expands wildcards, it detects and applies LoRA tags, and it handles the BREAK syntax that splits your prompt into separately-encoded chunks. One in, one out - the pipe goes in carrying a model and CLIP, and comes out with the LoRAs applied, the conditioning built, and the fully-expanded text available on a second output.

If you've used Impact Pack's wildcards, you already know the syntax: __tag__ tokens that get randomly replaced. The KB's impact-pack panel calls wildcards one of that pack's most-used invisible features, and this node rides the same machinery.

How it works

Three passes, in order:

  1. Wildcard expansion - __tag__ tokens are randomly resolved, and the random choice is driven by the seed inherited from the pipe. Same seed, same expansion - that's what makes a run reproducible.
  2. LoRA extraction and application - <lora:name:weight> tags are parsed out of the text, the matching file is loaded, and it's applied to the model and CLIP in the pipe. The pack even tracks which LoRAs are already applied (_applied_loras in the pipe) so you don't double-apply them when the prompt node runs again. Fancier loaders get used if present - Inspire's block-weight LoRA loader, or the Nunchaku loader for Flux.
  3. BREAK encoding - the text is split on BREAK, each chunk is encoded separately with CLIP, and the results are concatenated. This is the A1111-style trick for nudging the model's attention to parts of the prompt; chunks encoded separately land differently than one giant blob.

The select_to_add_lora and select_to_add_wildcard combo inputs are convenience pickers - they're there to insert tags into your text without typing them from memory.

The outputs that matter

  • PIPE - the updated pipe, with the LoRAs applied and positive/negative conditioning built.
  • POPULATED_TEXT - the fully-expanded text, after wildcards and LoRA tags. This is the one to wire into SAX Output's prompt_text so your saved images carry the actual prompt that ran, not the template with __random_stuff__ in it.

Installing it

It's in the SAX_Bridge pack. ComfyUI Manager → "Install via Git URL" → https://github.com/so16tm/SAX_Bridge, or:

cd ComfyUI/custom_nodes
git clone https://github.com/so16tm/SAX_Bridge

Restart. One dependency note that matters: wildcard expansion only works if comfyui-impact-pack is installed. Without it the node logs a warning and passes your text through as-is - LoRA tags and BREAK still work, but __wildcard__ tokens stay literal. If your prompts suddenly show raw underscores, that's the first thing to check.

Gotchas

The seed coupling is a feature and a trap: wildcard results change when the pipe's seed changes, so when you're hunting a specific composition, fix the seed or the text will reshuffle under you. And remember the LoRA dependency - the node can't read your mind about where LoRAs live; if a <lora:...> tag points at a file it can't find, it logs LORA NOT FOUND and skips it rather than failing. Silent-ish, so keep an eye on the console.

CategorySAX/Bridge/Prompt

Inputs (4)

NameTypeDefaultDescription
pipePIPE_LINE
wildcard_textSTRINGEnter your prompt using wildcard syntax. LoRA syntax and BREAK syntax are also supported.
select_to_add_loraCOMBO1 options: Select the LoRA to add to the text
select_to_add_wildcardCOMBO1 options: Select the Wildcard to add to the text

Outputs (2)

NameTypeDescription
PIPEPIPE_LINE
POPULATED_TEXTSTRING