ComfyUI Node

prompt - add

Add a tag to the head or tail of a prompt, the tag-aware way

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
prompt - add
    • STRING
    text
    toadd
    action

    "Add a tag to my prompt" is one of those things ComfyUI makes awkward: you end up hand-editing a string mid-workflow, which is fragile and unshareable. Prompt - add fixes it with an action dropdown: add2head, add2tail, del|add2head, del|add2tail, or none. It's tag-aware - it understands comma-separated tags and does the right thing, rather than blindly concatenating strings.

    The del| prefix is the part that surprises people in a good way. Those actions remove the tags you're adding from wherever they already are in the text, then add them at the head or tail. So "promote this tag to the front" is one action, not a delete-then-insert dance. That's genuinely the kind of workflow surgery that keeps a big prompt organized.

    How it works

    The node splits your text on commas, runs each tag through a normalizer (trim spaces, collapse internal runs), and then applies the chosen action:

    • add2head - prepends toadd (as a comma list) to the front
    • add2tail - appends it to the end
    • del|add2head / del|add2tail - first strips any matching tags from the body, then adds toadd at the chosen position
    • none - returns text untouched

    The tag-awareness matters because earlier tags carry more weight in most tag-based encoders. Moving a quality tag like masterpiece or a style token to the head is a real, if subtle, effect - this node makes that a one-click operation.

    Inputs and outputs

    • text - the prompt string to modify
    • toadd - the tag(s) to add, comma-separated for multiple
    • action - the dropdown above
    • Output: STRING - the modified prompt

    Installing it

    # ComfyUI Manager: search "ymc suite" and install ymc-node-suite-comfyui
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui
    

    Restart after installing. Dependencies are four small pure-Python PyPI helpers that self-install; no models, no GPU cost.

    Gotchas

    • It's designed for comma-separated tag prompts - SDXL-lineage style. On the newer LLM-encoded models, tag order and head-weighting mean less, so "promote to head" is more of a housekeeping move than a quality lever.
    • The del| variants match on the unweighted tag (parentheses and :weight stripped), so (masterpiece:1.2) counts as masterpiece for deletion. That's usually what you want, but know it's happening.
    • The prompt - add weight sibling is the one for attention-weighting a single keyword; this node is for list/tag surgery. Different jobs, don't confuse them.
    • WAS-conflict note as with the rest of the pack: if WAS Node Suite is installed too, Manager may flag shared node names between the packs.
    Categoryymc suite/text

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    toaddSTRING
    actionCOMBO5 options: add2head, add2tail, del|add2head, del|add2tail, none

    Outputs (1)

    NameTypeDescription
    STRINGSTRING