ComfyUI Node

Smart Prompt

A prompt box that strips // comments and rolls { A | B | C }

By slvslvslv·Created 2 years ago·Updated 7 days ago· 3
Smart Prompt
  • clip
  • text
  • conditioning
text
seed

Smart Prompt is the node this pack's author actually announced on r/StableDiffusion, and it's the one you'll reach for daily once you install it. It's a prompt text box that does three things in one place: syntax-highlights the text in the UI, strips // comments out of what actually reaches the model, and gives you { A | B | C } random selection with an optional seed. If you've ever saved a workflow and come back to a mystery prompt, the comment stripping alone is worth it.

The comment behavior is the killer feature for shared workflows. The convention of leaving // notes in a prompt box is everywhere in the WAN and HunyuanVideo workflow scenes - it's how people document what a prompt is doing. The problem is that text normally goes straight into the CLIP encoder, comments and all. Smart Prompt removes everything from // to the end of the line, drops the now-empty lines, and passes the clean string downstream. So // cinematic, slow dolly never pollutes your conditioning.

The random syntax is the other trick. Write { red | blue | green } dress and the node picks one option per run. Leave the seed unconnected and it re-rolls on every queue - handy when you're batch-testing. Connect seed and the same text plus same seed always produces the same pick, which is how you make a "random" prompt reproducible for a workflow you're sharing. It handles multiple brace groups per prompt and even empty options like {cat|} for "cat or nothing". The tooltip warns about the two behaviors plainly: comments cleaned, { A | B | C } picked.

The node has two outputs: text (the cleaned, resolved string) and conditioning. Hook the optional clip input and it encodes the cleaned text for you, so you can skip the separate CLIPTextEncode entirely. No clip connected? You still get text, which you can route into any other text node or encoder - many people wire text into a normal CLIPTextEncode so they can use the encoding they're used to. The syntax highlighting is a front-end extension the pack ships in its js/ folder, so it shows up in the web UI automatically after a refresh.

One thing to know before you lean on it: the { A | B | C } and // handling only happens in this node's text. If you paste the same prompt into a plain CLIPTextEncode, you get raw braces and comments. Treat Smart Prompt as the front door for anything that needs the treatment.

It's a lightweight node with zero dependencies, so installation is painless. In ComfyUI Manager, search "Smart Helper Nodes" and hit install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartHelperNodes

Then restart ComfyUI (and refresh the browser tab so the highlighting extension loads). The pack's requirements.txt is empty - nothing extra to pip install.

CategorySmartHelperNodes

Inputs (3)

NameTypeDefaultDescription
textSTRINGEnter your prompt text. Lines with // comments will be cleaned up. Use { A | B | C } for random selection.
clipoptCLIPOptional CLIP model for encoding the text.
seedoptINTOptional seed for deterministic random selections. Same seed always produces the same result.

Outputs (2)

NameTypeDescription
textSTRING
conditioningCONDITIONING