Nodes/ComfyUI-Prompt_Library/Double Prompt Encode
ComfyUI Node

Double Prompt Encode

Double Prompt Encode

By hexxacubic·Created about a year ago·Updated 2 months ago· 7
Double Prompt Encode
  • clip
  • positive
  • negative
double_prompt

The name oversells it a little. Double_Prompt_Encode doesn't encode two prompts - it takes one string that carries a positive and a negative side, splits them, and produces the two CONDITIONING tensors your KSampler wants. It's the missing middle step of this whole pack: every other node in ComfyUI-Prompt_Library outputs a "double prompt" string, and this is the node that turns that string into actual conditioning you can sample from.

If that sounds like two of ComfyUI's stock CLIP Text Encode (Prompt) nodes mashed into one, it basically is. The point is the workflow shape it enables: you can pipe the output of a randomizer or a prompt library straight into a single text port, and both the positive and negative side update at once.

How it works

Give it a CLIP (drag a wire from your checkpoint or CLIP loader) and a double_prompt string. The node hunts for --- or ---- anywhere in that text - mid-line, own line, doesn't care - and splits on the first one it finds. Everything before becomes the positive conditioning, everything after becomes the negative. If there's no separator at all, the whole string is treated as positive and the negative side is encoded as an empty string.

The encoding itself is the standard CLIP path (tokenizeencode_from_tokens with pooled output), wrapped into the same [[cond, {"pooled_output": pooled}]] list format every ComfyUI conditioning node uses. The source comment notes it deliberately sticks to that older, more stable API rather than the newer convenience wrappers, so it keeps working across ComfyUI versions. No voodoo, no extra models.

The inputs and outputs that matter

  • clip - your CLIP model. Required.
  • double_prompt - a STRING that comes in over a wire (it's a forceInput port), not just a text box. That's deliberate: you're meant to chain this to Prompt_Library, RandomLine, Prompt_Extender, or any other node that emits a double-prompt string.

Outputs:

  • positive - CONDITIONING → KSampler's positive input.
  • negative - CONDITIONING → KSampler's negative input.

That's the whole node. The one thing to remember is that positive is the first output and negative the second - get them swapped and you're sampling toward the bad stuff.

How to install it

Install the pack via ComfyUI Manager (search ComfyUI-Prompt_Library), or:

cd ComfyUI/custom_nodes
git clone https://github.com/hexxacubic/ComfyUI-Prompt_Library

Restart ComfyUI. There's no requirements.txt and no pip install step - the whole pack is standard-library Python plus ComfyUI's own APIs, so nothing heavy to pull in. The nodes land under the hexxacubic category in the node menu.

Where people get burned

The classic mistake is typing a separator that doesn't match. If you use - (em dash) or a single -, the node won't split and your entire "negative" silently becomes part of the positive prompt. The convention is exactly three or four hyphens: ---. If you set prepend_mode on an upstream node, remember the separator still has to be there - most of this pack's siblings normalize to a clean --- on its own line, but hand-typed strings won't.

One more honest caveat: an empty negative conditioning is legal but rarely good on CFG-based SD1.5/SDXL-lineage models. If you're only feeding a positive string, consider keeping a stub negative like blurry, low quality in there - it costs nothing and steadies results.

Categoryhexxacubic

Inputs (2)

NameTypeDefaultDescription
clipCLIP
double_promptSTRING

Outputs (2)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING