Nodes/quadmoon's ComfyUI nodes/Save Smart Prompt Config
ComfyUI Node

Save Smart Prompt Config

Store a Prompt Template With a Live Hole for the Changing Part

By traugdor·Created 3 years ago·Updated 9 months ago· 16
Save Smart Prompt Config
  • trigger
  • FULL_PROMPT
  • PROMPT_TEXT
prompt_start
image_content
prompt_end
config_name

Most prompt templates have a stable part - the style, the framing, the boilerplate - and a part that changes every run, like the subject. This node stores the stable skeleton per model and leaves the changing part as a placeholder that gets filled in live. It's the "save" half of the pack's Smart Prompt system, and the placeholder trick is the clever bit.

Why you'd reach for it

If you find yourself retyping the same 40-word prompt frame around a different subject every session, this is the node that stops it. You save the skeleton once - the opening words, the closing quality tags - and the pack's CLIPTextEncode - Smart Prompt loader later substitutes whatever current text you feed it into the middle. Because it's keyed to the model via the trigger, the same named template can hold different skeletons for different checkpoints without collisions.

How it works

The node takes three parts: prompt_start, image_content (the changing middle), and prompt_end. It assembles the full prompt as start + ", " + content + ", " + end for immediate use, but what it saves to the JSON config store is start + ", " + <model-hash-placeholder> + ", " + end. Later, when the smart prompt loader runs, it looks up that saved skeleton and replaces the hash placeholder with the text you're typing right now. That indirection is what turns a stored template into a reusable one - the same saved config serves a hundred different subjects.

Inputs and outputs

  • prompt_start - the stable opening (wire-in, so it can come from any text source).
  • image_content - the changing middle; default empty, multiline.
  • prompt_end - the stable closing (wire-in).
  • trigger - the SMART_TRIGGER output from Load Model - Smart.
  • config_name - the name of the template slot.

Outputs: FULL_PROMPT (the assembled start+content+end, for immediate use in a text encoder) and PROMPT_TEXT (just the image_content part).

Installing it

Part of "quadmoon's ComfyUI nodes". ComfyUI Manager: search the pack title or Install via GIT URL with https://github.com/traugdor/ComfyUI-quadMoons-nodes.git. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/traugdor/ComfyUI-quadMoons-nodes.git

Restart ComfyUI. No models or dependencies.

Common issues

The same family of gotchas as the other smart nodes: you need the trigger from Load Model - Smart, not a core checkpoint loader; the configs live in qmSmartNodesConfig.json in ComfyUI's working directory (copy it when you move machines); and renaming a checkpoint file re-hashes its key, orphaning saved templates. One more that's specific here: because prompt_start and prompt_end are wire-only inputs, most people feed them from plain text nodes or the pack's string converters - if you expected to type into this node, look for the input wires instead. The author flags Smart Prompt as a work-in-progress, so expect the edges to be rougher than the rest of the pack.

CategoryQuadmoonNodes/SmartNodes

Inputs (5)

NameTypeDefaultDescription
prompt_startSTRING
image_contentSTRING
prompt_endSTRING
triggerSMART_TRIGGER
config_nameSTRING

Outputs (2)

NameTypeDescription
FULL_PROMPTSTRING
PROMPT_TEXTSTRING