Reserve Tag
Reserve Tag pulls the tags you care about out of the noise
- STRING
Reserve Tag is the pack's extractor: it filters a comma-separated tag string down to only the tags you name, and throws the rest away. You give it a list of tags you want to keep and a number, and it returns just the matches. Everything else in the source string is discarded.
That sounds narrow, but it's genuinely handy in a few spots. Say a WD14 tagger dumped forty tags and you only want to check what character and quality tags it found - reserve 1girl, masterpiece, best quality and the node hands you just those, if present. Or you're splitting one prompt string into branches: reserve the character tags for one path and everything else for another. It also works as a sanity check on caption sources - a fast "does my caption actually contain the trigger word?" probe without reading the whole string.
How it works
The node splits the source tag_text on commas, then walks through your reserve_tag list. For each tag that exists in the source, it inserts it at the front of a new result list and bumps a counter, stopping when the counter reaches reserve_tag_number. The output contains only the reserved tags - the rest are gone, not hidden.
Two behaviors to know before you trust the output. First, the result is reversed: because each found tag is inserted at the front, the first tag in your reserve list ends up last in the output. Second, reserve_tag_number is a cap on successful matches, not a target - if only two of your three listed tags are present, you get two. And if nothing matches, you get an empty string, which is worth checking downstream.
Inputs and output
- reserve_tag (required, multiline): the tags to keep, comma-separated.
- reserve_tag_number (required): max number of matches to keep, default 1.
- tag_text (optional): the string to filter.
- STRING output: just the reserved tags.
Because matching is exact (after whitespace trim), the tag has to appear in the source verbatim. On Danbooru-style strings that's usually fine - the vocabulary is standardized - but a caption written in natural language won't match tag names.
Installing it
Same pack, same story: no dependencies beyond ComfyUI's own, no models to fetch, empty README that you should ignore in favor of the source. Install via ComfyUI Manager (search ComfyUI-Aimidi-nodes) or:
cd ComfyUI/custom_nodes
git clone https://github.com/AiMiDi/ComfyUI-Aimidi-nodes
Restart ComfyUI and look for the blue ComfyUI Aimidi Nodes: Loaded console message.
Common issues
The big one is the reversal - people reserve masterpiece, best quality and get best quality, masterpiece, then assume it's broken. It isn't. Second: an empty output usually means the tags simply aren't in the source, not that the node failed. And remember it filters, it doesn't reorder or dedupe the rest - there is no "rest," by design. If you want reordering instead of extraction, use Move Tag To Top from this same pack.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| reserve_tag_number | INT | 1 | — |
| reserve_tag | STRING | — | |
| tag_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |