Nodes/babydjac Nodes/Prompt Merge
ComfyUI Node

Prompt Merge

Merge Tag Lists Without the 500th 'And Then' Node

By babydjac·Created 7 months ago·Updated 5 months ago· 12
Prompt Merge
    • merged
    taglist_a
    taglist_b
    extra_taglist
    dedupetrue
    lowercasefalse
    sort_alphafalse
    max_tokens0

    Prompt text nodes have a nasty habit of breeding. You've got a character prompt in one box, a style list in another, an environment list in a third, and you need them all in one string - which means yet another concatenation node, or worse, manually gluing them together every time you change something. Prompt Merge from the babydjacNODES pack is the clean answer: two (or three) tag lists in, one merged string out, with dedupe, casing, sorting, and truncation built in.

    It's pure, local Python - no API, no cost, deterministic. The pack's README even ships a real UI demo of it (the pack author recorded a live graph run), which tells you it's one of the nodes he actually uses.

    How it works

    The node takes up to three taglist inputs, splits each on commas and newlines (so a multiline list works the same as a comma list), concatenates them, then applies your flags:

    • dedupe (default on) - removes exact duplicates after normalizing whitespace. Handy when the same tag shows up in two of your lists.
    • lowercase - folds everything to lowercase.
    • sort_alpha - alphabetically sorts the merged list.
    • max_tokens - 0 means no limit; otherwise it truncates to the first N tags. Note: it's a tag count, not a real token count, so "max_tokens" is a slightly optimistic name.

    The output is the tags joined with ", " - ready to feed a text encoder.

    The inputs that matter

    • taglist_a / taglist_b - required. Your two main lists.
    • extra_taglist - the optional third list.
    • dedupe - keep it on; duplicate tags in a prompt are usually a mistake, not emphasis.
    • sort_alpha - turn on when you want stable output for seed comparisons; turn off when tag order matters (it often does - Pony and Flux both read the beginning more strongly).

    Output: a single STRING, merged.

    Install

    ComfyUI Manager → babydjacNODES, or git clone https://github.com/babydjac/babydjacNODES into ComfyUI/custom_nodes, restart, hard-refresh. No extra pip deps.

    Gotchas

    • Truncation cuts from the front, and it's a tag count. max_tokens: 75 keeps the first 75 tags, not the most important 75. If your lists put quality tags last, truncation can silently drop your score_9.
    • Dedupe is exact-after-whitespace-normalization. blonde hair and blonde_hair are different tags to this node; it won't reconcile them. That's what the Taglist Sanitizer in the same pack is for - they chain nicely (sanitize first, then merge).
    • Order of operations is fixed: concatenate → lowercase → dedupe → sort → truncate. The lowercase + sort_alpha combination means the sort is on the lowercased form, which is what you want.

    For anyone juggling multiple tag sources - a character list from a picker, a style list, a quality-booster list - Prompt Merge turns the messy middle of your workflow into one node. Simple, local, and it just works.

    CategorybabydjacNODES/Utils

    Inputs (7)

    NameTypeDefaultDescription
    taglist_aSTRING
    taglist_bSTRING
    extra_taglistoptSTRING
    dedupeoptBOOLEANtrue
    lowercaseoptBOOLEANfalse
    sort_alphaoptBOOLEANfalse
    max_tokensoptINT00–10000

    Outputs (1)

    NameTypeDescription
    mergedSTRING