ComfyUI-TagForge Introduction
<p align="center">
<img src="https://raw.githubusercontent.com/huchukato/ComfyUI-TagForge/main/banner.png" alt="ComfyUI-TagForge banner" width="100%" />
ComfyUI-TagForge helps you write and vary prompts in ComfyUI. It suggests tags as you type, lets you browse the contents of wildcard files, and provides a WildcardProcessor node that turns wildcard-based text into a finished prompt.
These tools address two common interruptions to a creative workflow: remembering the exact tag you want and manually rewriting prompts to try different combinations. You can use suggestions to find tags, choose a specific wildcard option when you want control, or leave options in a prompt for the processor to resolve when the workflow runs.
Watch the demo of tag completion and wildcard sub-selection.
How ComfyUI-TagForge Works
Think of tag completion as a searchable prompt vocabulary. As you type, the extension looks for matching entries in its tag files and shows suggestions you can insert. For example, if you are looking for a particular clothing tag, you can start typing rather than recalling its full wording.
A wildcard is a placeholder for an option stored in a wildcard file. A placeholder looks like __color__. The extension offers two ways to use it:
- Choose an option while writing: Type
__, select a wildcard, and browse the options from its file. Choosing an option replaces the placeholder with that text. - Let the workflow choose: Keep the placeholder in your prompt and send it to the WildcardProcessor node. The node resolves it when the workflow runs.
For example, A beautiful __color__ landscape painting could become A beautiful red landscape painting. Wildcard files supply the available options; each line in a file is shown as a separate choice when you browse it.
The processor can also make choices directly from prompt text. In A {cat|dog|bird} sitting on a {chair|table|floor}, the groups in braces offer alternatives. One processed result might be A cat sitting on a chair. The exact result depends on the choices made during processing.
ComfyUI-TagForge Features
Tag suggestions
The extension suggests tags from CSV files, including Danbooru, e621, and custom tag collections. You can choose a Main Tags file and an Extra Tags file in settings. Main-file choices come from CSV files in the tags folder whose names do not start with extra; extra-file choices come from CSV files whose names do.
Several settings control how suggestions feel and how selected tags appear in your prompt:
| Setting | What it changes |
|---|---|
| Enable | Turns the completion feature on or off. |
| Translate file | Lets you select a translation file. |
| Delimiter | Sets the character used to separate inserted tags: a comma, a period, or none. |
| Add ‘Space’ after separator | Adds a space after the chosen separator for easier-to-read prompt text. |
| Insert Tag on Tab key / Enter key | Lets you choose which keys insert a highlighted suggestion. |
| Max Suggestions to Display | Limits how many results appear at once. 0 displays all suggestions, which may be heavy with a large tag file. |
| Add Wiki Link Button | Adds a Danbooru or e621 wiki-link button beside applicable suggestions, so you can check an unfamiliar tag. |
| Replace ‘_’ to ‘Space’ | Replaces underscores in inserted tags with spaces. |
| Completion delay (ms) | Sets how long the extension waits after you type before showing suggestions. |
| Enable Embeddings / Enable LoRAs / Enable Wildcards | Includes those items in suggestions when enabled. |
| Restrict Alias | Shows aliases only on an exact match. For example, the alias 1girls → 1girl is displayed when you type 1girls, rather than appearing in broader searches. |
A shorter suggestion list can make a large tag collection easier to browse. A longer completion delay can keep suggestions from appearing while you are still typing a word.
ComfyUI-TagForge settings (https://files.catbox.moe/0ai9mj.png)
Category filtering
To narrow tag suggestions to a category, start your search with -- followed by a category name. For example, --character fate shows results matching fate within the character category. Available category names are listed in the Category Map.
Category-filter example (https://files.catbox.moe/bir330.png)
Prefixes
You can add text before a tag you select by typing ++ followed by your prefix. For example, with ++pink skirt, selecting the suggestion pleated skirt inserts pink pleated skirt. Multiple prefixes can be set.
Prefix example (https://files.catbox.moe/uddq2d.png)
Wildcard sub-selection
Wildcard sub-selection lets you inspect a wildcard’s options before deciding whether to use one. This is useful when you want the convenience of a wildcard collection but need precise control over the current prompt.
- Type
__to see available wildcards. - Use the arrow keys to highlight a wildcard and press Enter. Its placeholder, such as
__color__, is inserted. - The extension displays the options from that wildcard file.
- Highlight an option and press Enter to replace the placeholder with it. Alternatively, press Esc to close the options and keep the placeholder for later processing.
The browser supports wildcard names containing paths, displays file entries line by line, and truncates long options in the list; you can hover to see expanded text. It can discover wildcards from the extension’s wildcards/ folder, ComfyUI’s models/wildcards/, DynamicPrompts, extra model paths, and Impact Pack locations.
WildcardProcessor node
The WildcardProcessor node resolves placeholders and choice expressions inside a prompt. Connect prompt text to its required text input, then connect its processed_text output to the next part of your workflow. Its optional seed input controls randomization; 0 requests a random seed, while a specified seed can help reproduce a result.
The node supports:
| Prompt syntax | What it does | Example |
|---|---|---|
__keyword__ | Chooses an entry from a wildcard file. | A __color__ landscape |
{option1|option2|option3} | Chooses between options written in the prompt. | A {cat|dog|bird} |
weight::option | Gives choices different selection weights. | {2::portrait|1::landscape} gives portrait twice the selection weight of landscape. |
count#__keyword__ | Expands multiple wildcard instances. | 3#__color__ flowers could produce red yellow blue flowers. |
{2$$, $$a|b|c} | Selects multiple options and joins them with a chosen separator. | {2$$, $$apple|orange|banana} could produce apple, orange. |
{2-4$$; $$__wildcard__} | Uses a range for the number of selections and a custom separator. | The result depends on the wildcard’s entries. |
The node also supports nested wildcards, such as choices containing __indoor__, and offers populate, fixed, and one-shot reproduce modes inspired by Impact Pack. Cache controls provide full-cache or on-demand loading, refresh, and status information. An optional session downvote setting reduces repeated choices without removing them.
What’s New with ComfyUI-TagForge
v2.1.1 — Wildcard processing fixes
- Fixed processing of wildcards with deeply nested paths, such as
__pmp/prmpt/lctns/rndmlctns__. - Fixed dynamic choices containing wildcards, such as
{__indoor__|__outdoor__|__special__}. - Improved Impact Pack compatibility by implementing its processing logic and using wildcard matching that works across different path depths.
These fixes matter most if you use organized wildcard folders or combine several wildcard expressions in one prompt: they help the processor resolve those prompts more reliably.
v2.0.0 — Wildcard sub-selection
- Added the ability to select an individual option from a wildcard file while writing a prompt.
- Added automatic display of options after inserting a wildcard, with arrow-key and Enter navigation.
- Added the WildcardProcessor node for resolving dynamic prompts in a workflow.
- Added category filtering and prefix support.
Together, these changes let you move between hands-on prompt editing and automatically varied prompts without maintaining separate versions of the same idea.
Troubleshooting ComfyUI-TagForge
I typed __, but I do not see wildcards. What should I check?
- Open the extension settings and check that Enable and Enable Wildcards are on.
- Check that your wildcard files are in a supported source, such as the extension’s
wildcards/folder or ComfyUI’smodels/wildcards/. - If you have just added wildcard files, restart ComfyUI so they can be loaded.
My tag search shows too many results or feels slow.
- Set Max Suggestions to Display to a manageable number instead of
0, which displays all results. - Use a more specific search, or filter by category with syntax such as
--character fate. - Adjust Completion delay (ms) if suggestions appear before you have finished typing.
A wildcard placeholder is still in my prompt. Is that an error?
Not necessarily. Pressing Esc during sub-selection deliberately keeps the placeholder. If you want a specific option in the text, reopen the wildcard’s choices and select one. If you want the workflow to choose, pass the prompt through WildcardProcessor and use its processed_text output.
How can I repeat a processed prompt result?
Set a specific value on the WildcardProcessor’s optional seed input. A value of 0 requests a random seed, so it is not the setting to use when you want a repeatable choice.
Can the processor handle a wildcard inside a choice group?
Yes. Version 2.1.1 fixed processing for expressions such as {__indoor__|__outdoor__|__special__} and for wildcards in deeply nested paths.
Learn More about ComfyUI-TagForge
- Watch the feature demo to see tag completion and wildcard sub-selection in action.
- Consult the Category Map when you want to filter tag suggestions.
- Learn about the projects that inspired parts of this extension: a1111-sd-webui-tagcomplete for tag completion and wildcard selection, and ComfyUI-Custom-Scripts.
- Explore ComfyUI for broader information about workflows and nodes.
