ComfyUI Node

Add Tag

Add tags to the front of a prompt string — duplicates handled for you

By AiMiDi·Created 2 years ago·Updated 2 years ago· 0
Add Tag
    • STRING
    add_tag
    tag_text

    Add Tag is the ComfyUI-Aimidi-nodes way to prepend tags to a comma-separated tag string without retyping the whole thing. You feed it an existing tag string and a list of tags to add; it drops those tags onto the front of the list and quietly removes any that were already there. One node, one string out, no duplicates, no "which prompt box did I put this in" confusion.

    Why front? Because on every SDXL-lineage model - Illustrious, NoobAI, WAI, Pony - earlier keywords get stronger attention than later ones. If you've ever hand-copied masterpiece, best quality, very aesthetic in front of a long WD14-tagger dump, that's exactly the chore this node automates. It's built for the Danbooru-style tag strings those taggers emit, and it assumes you're working in that comma-separated format.

    How it works

    The node splits both inputs on commas, strips whitespace, and then for each tag you asked to add it does two things: removes the tag from the existing string if it's already there, then inserts it at position 0. Net effect: your added tags end up at the head of the string, deduplicated, with the original order of everything else preserved.

    One quirk worth knowing: because each tag is inserted at the front in sequence, the tags you type get reversed. Add masterpiece, best quality to 1girl, standing and you get best quality, masterpiece, 1girl, standing. Functionally harmless on models that don't care much about order within the first few tags, but if you're obsessive about ordering you'll notice. If you need surgical control, the sibling Move Tag To Top node in the same pack is the better tool.

    Inputs and output

    • add_tag (required, multiline): the tags you want to add, comma-separated. Multiline means you can paste a whole tag block.
    • tag_text (optional): the existing tag string to modify. Leave it empty and the output is just your added tags.
    • STRING output: the combined string. Wire it straight into your positive prompt input.

    There's no forceInput requirement that matters here - you can type tag_text directly or wire it from another node like Load Images Pair Batch in this same pack.

    Installing it

    The pack's README is basically empty (literally just the title), but the good news is it needs nothing special. No requirements.txt, no model downloads, no PyAV or torchvision extras - just numpy, torch, and PIL, which ComfyUI already ships. Install via ComfyUI Manager by searching ComfyUI-Aimidi-nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AiMiDi/ComfyUI-Aimidi-nodes
    

    Restart ComfyUI and you should see a blue ComfyUI Aimidi Nodes: Loaded line in the console. That's your confirmation it worked.

    Common issues

    The main gotchas are behavioral, not breakage. If the node "doesn't do anything," check that your tag strings are actually comma-separated - the node splits on commas, so a space-separated or newline-separated list won't be treated as multiple tags. And remember the front-insertion reversal: type your tags in the order you want them to end up, because the last one you list lands first.

    CategoryAimidi Nodes

    Inputs (2)

    NameTypeDefaultDescription
    add_tagSTRING
    tag_textoptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING