Process Tags
One node to clean, filter, and auto-BREAK your entire tag prompt
- clip
- processed_text
- filtered_tags_list
ProcessTags is the pack's flagship prompt node: a single node that runs the whole tag-cleaning pipeline on your prompt - replace underscores, filter blacklisted tags, remove redundant subtags, and optionally auto-insert BREAK for the SDXL 75-token limit - in one pass. It's the "just make this prompt good" button for the Danbooru-tag workflow, and it's the node you reach for when your prompt has been assembled by an LLM or scraped off Danbooru and is full of the usual cruft.
If you've ever fed a raw tag dump into a sampler and watched it silently ignore half the tags or blow past the token window, this is the node that fixes both. It's really four of the pack's individual prompt nodes chained in order - ReplaceUnderscores → FilterTags → FilterSubtags → SDXLAutoBreak - but with one set of inputs and one output to wire.
How it works
The pipeline, in order:
- Replace underscores (
replace_underscores, default on) -white_dressbecomeswhite dress. - Filter tags (
filter_tags, default on) - removes anything matching yourblacklist_tags, which supports the pack's wildcards (e.g.__color__expands to every color inresources/wildcards.yaml). - Filter subtags (
filter_subtags, default on) - drops tags that are redundant subparts of a longer tag already present (dogandcatget removed fromdog, cat, white dog, black cat). - Auto BREAK (
auto_break, default off) - needs aclipinput; inserts BREAK tokens so each segment stays within the 75-token CLIP window, using the SDXL tokenizer.
fixed_tags lists tags that survive steps 2 and 3 no matter what - use it for the tags you absolutely want, like a character name or quality tags. The second output, filtered_tags_list, is a list of the tag groups that got removed at each filtering step, which is great for auditing why something disappeared from your prompt.
One thoughtful detail: the node preserves your original BREAK separators and whitespace when reassembling the text (auto_break off), so it doesn't mangle hand-placed BREAKs.
Inputs that matter
text- your prompt. The one required thing.blacklist_tags- comma-separated tags to strip, wildcards allowed. This is the input you'll actually tune.auto_break+clip- flip the toggle on and wire your CLIP in only if you're on SDXL and want token-safe BREAKs.
Outputs: processed_text (the cleaned prompt) and filtered_tags_list.
Install
Part of ComfyUI-Alchemine-Pack:
cd ComfyUI/custom_nodes
git clone https://github.com/alchemine/comfyui-alchemine-pack
pip install -r requirements.txt
Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). Only dependency is python-dotenv; no model downloads.
Common issues
The most common surprise is the subtag filter being too aggressive: dog, cat on their own are fine, but if your prompt mentions dog and separately white dog, the bare dog is dropped as redundant. That's by design (see the README example), and it's usually what you want - but if a "missing" tag bothers you, add it to fixed_tags. Auto-break silently does nothing unless clip is wired in; the toggle alone isn't enough. And remember the wildcards only expand what's defined in the pack's wildcards.yaml, so a __color__ you invent won't match anything.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| replace_underscores | BOOLEAN | true | — |
| filter_tags | BOOLEAN | true | — |
| filter_subtags | BOOLEAN | true | — |
| auto_break | BOOLEAN | false | — |
| clipopt | CLIP | — | |
| blacklist_tagsopt | STRING | — | |
| fixed_tagsopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| processed_text | STRING | — |
| filtered_tags_list | STRING | — |