Nodes/ComfyUI-AI-Assistant/Clean Prompt Tags
ComfyUI Node

Clean Prompt Tags

Remove Whole Color Families From a Prompt in One Paste — Yes, the Example Has Pink Panties

By JackEllie·Created 2 years ago·Updated 2 years ago· 24
Clean Prompt Tags
    • string
    • show_help
    string
    Clean_Prompt

    Clean Prompt Tags solves a weirdly specific problem: you have a long Danbooru-style tag prompt and you want to strip every tag that mentions a certain word. Say a model is collapsing on color - blue hair, blue sky, blue dress, all of it - and you want them gone in one shot. You could delete them by hand, or you could paste the offending word into this node and let it nuke the whole family at once. That's the whole tool, and for the anime-tag ecosystem it's genuinely handy.

    The author's own example is the best description of what it does: a base prompt of masterpiece, best quality, monochrome, greyscale, blue_hair, blue_sky, blue_dress, pink_eyes, pink_bow, pink_panties, a clean list of pink, red, orange, brown, yellow, green, blue, purple, blonde, colored skin, white hair, and the output is just masterpiece, best quality, monochrome, greyscale. (Yes, "pink_panties" is in the official example. The author has a sense of humor. Or a type.)

    How it works - and where it's crude

    The mechanism is substring matching. Each tag in your base prompt is checked against each entry in the clean list, case-insensitively: a tag is dropped if any clean entry appears anywhere inside it. That's why pink catches pink_eyes, pink_bow and pink_panties in one go - the substring trick is the feature.

    But it's also the trap. Because it's substring-based, short clean entries over-match: red will also remove red_eyes (fine) but nothing weird like bored - actually, yes, red inside bored would remove it too. And white hair removes white_hair but also white_haired_man, which might be exactly what you want or a surprise. The author literally labels it a "rough removal tool" in the source. For surgical, exact-tag removal, the same pack's Prompt Blacklist node does whole-tag matching instead.

    The inputs and outputs

    Two multiline text inputs: string is your base prompt (it's marked forceInput, so you can wire it from another node), and Clean_Prompt is the comma-separated list of substrings to remove. Outputs are string - the cleaned prompt, ready for your CLIP Text Encode - and show_help, which just echoes the author's example. If your clean list is empty, nothing gets removed and your prompt passes through mostly untouched (aside from a re-join with ", ").

    Installing it

    It's part of JackEllie/ComfyUI_AI_Assistant, a small fork of tori29umai0123's AI-Assistant. Install via ComfyUI Manager (search "ComfyUI-AI-Assistant") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JackEllie/ComfyUI_AI_Assistant
    

    Restart after. No models to download, pure text processing on CPU. The pack's requirements only declare opencv-python; the module also imports skimage at load, so if the whole pack refuses to load with a missing-module error, pip install scikit-image.

    When to reach for it

    Use it when you want to kill a color or keyword across the whole prompt in one shot, or when you're running batch experiments and want to see what a prompt looks like without an entire attribute family. Don't use it when you need precision - that's Prompt Blacklist's job. And don't be surprised when a short word takes out a tag you didn't expect; that's substring matching doing what it says on the tin.

    Categoryadvanced/AI_Assistant/text

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING
    Clean_PromptSTRING

    Outputs (2)

    NameTypeDescription
    stringSTRING
    show_helpSTRING