ComfyUI Node

Prompt Extender

Prompt_Extender

By hexxacubic·Created about a year ago·Updated 2 months ago· 7
Prompt Extender
    • double_prompt
    prompt_additionsbeautiful, high quality --- blurry, low quality
    prepend_modefalse
    double_prompt

    Prompt_Extender is the glue node in the ComfyUI-Prompt_Library pack: the one that merges a base double-prompt with an extra block of additions and hands back one clean prompt. Think of it as "what you've got, plus what I always want on top." It's the classic global style/quality layer + random variation pattern - a randomizer picks the subject, this node bolts on your lighting-and-quality boilerplate, and the result feeds the encoder.

    It's also quietly the smartest node in the pack, because it deduplicates.

    How it works

    The node takes two double-prompt strings - the optional double_prompt input (over a wire) and prompt_additions (typed in the node). It parses each one into its positive and negative halves using the pack's --- convention (it even tolerates - and -), splits both sides into individual tags, and merges them.

    The merge is where it earns its keep: tags are split on commas, semicolons, and newlines, then combined in order with exact duplicates dropped. So if your random line already contains high quality and your global block adds high quality again, you get one copy, not high quality, high quality. It handles the positive and negative sides independently, which is the detail most prompt-merging utilities get wrong.

    prepend_mode controls the order: false (default) appends the additions after the base, true puts them first. The output is always normalized to a clean --- on its own line, so whatever mess came in, the next node downstream gets tidy input.

    Inputs and outputs

    • prompt_additions - the block you're adding. Defaults to beautiful, high quality\n---\nblurry, low quality, which is a fine template.
    • prepend_mode - append (default) or prepend.
    • double_prompt - optional wire input with your existing prompt. If nothing is connected, the node just returns prompt_additions cleaned up - handy on its own.

    Output:

    • double_prompt - the merged string. Wire it into Double_Prompt_Encode for conditioning.

    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. Pure standard-library Python, no dependencies, no model downloads. Found under the hexxacubic category.

    Where people get burned

    The dedup is exact-match on the string level. (word:1.2) and word are different strings, so weighted tags won't collapse - that's usually what you want (the weighted one is intentionally different), but don't expect sunlight and (sunlight:1.1) to merge. Also, dedup is case-sensitive, so masterpiece and Masterpiece survive separately.

    The other trap: if the base input is an empty string, the node treats it as "nothing connected" and returns only the additions. That's a reasonable behavior, but it means a Prompt_Library returning an empty prompt will silently swallow your random variation instead of combining it. If your output looks mysteriously short, check that the upstream prompt isn't coming back empty.

    Where you place it matters on SDXL-lineage models - earlier tokens carry more weight. Append mode is the safe default; flip to prepend when the additions are the thing you want driving the image, not the background texture.

    Categoryhexxacubic

    Inputs (3)

    NameTypeDefaultDescription
    prompt_additionsSTRINGbeautiful, high quality --- blurry, low quality
    prepend_modeBOOLEANfalse
    double_promptoptSTRING

    Outputs (1)

    NameTypeDescription
    double_promptSTRING