Prepend Tags
Put the important words first
- string
Tag order is not decoration. On Danbooru-trained models, earlier tokens get stronger attention - which is exactly why the KB's prompt-engineering doc stresses putting the important concepts first. Prepend Tags is the node that enforces that rule without hand-editing: it takes a comma-separated tag string, inserts your chosen tags at the front, and returns the merged list.
If you've ever built a prompt in parts - a base tag list from a file, plus a quality-tag prefix like masterpiece, best quality, very aesthetic that should lead the whole thing - you've reinvented this node by hand. With Prepend Tags, the prefix lives in its own widget or wire and gets glued to the front every run, so you can swap the base tags or the prefix independently.
Inputs and outputs
string(STRING) - the existing comma-separated tag list.tags(STRING, multiline) - the tags to insert before it.string(STRING) out - the merged list, prefix first.
Both inputs are strings, so either can come from a constant, a file loader, or a prior tag node.
How it works
It splits both inputs on commas (trimming whitespace), concatenates prepend + original, and re-joins them with commas. The splitting means it plays nicely with messy spacing and doesn't mangle individual tags. Note it doesn't dedupe - if a tag appears in both parts, you get it twice, so pair it with the pack's Unique Tags when that matters.
Where it fits
The classic pattern is a shared quality-tag or style prefix applied to many prompts - the same set of leading tags on every generation, without pasting them everywhere. Since earlier attention is stronger, this is the legit way to make sure masterpiece and your most important concept actually lead the sequence rather than hiding in the middle.
Install
FairLab, one pack: ComfyUI Manager (search ComfyUI-FairLab) or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, then look under Fair/string. No extra dependencies.
Gotchas
- No deduplication - overlapping tags get repeated. Add a dedupe step if your pipeline is sensitive to it.
- It joins with commas and spaces; if you're feeding a model that wants
underscore_styletags instead ofunderscore style, the pack's other tag utilities are the place to fix that up. - The node is marked as an output node, so it always fires - harmless here since it's cheap, but worth knowing it won't cache away mid-graph.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — | |
| tags | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |