ComfyUI-CLIPTextEncodePro
A smarter prompt box for ComfyUI. CLIP Text Encode (Pro Editor) is a drop-in replacement for the stock CLIP Text Encode node with a toolbar for searching the prompt, highlighting repeated tags, removing duplicates, commenting tags out with Ctrl+/ and (experimental) sorting tags by category.
It is a new node: the stock CLIP Text Encode is not modified, so you can use both side by side.
English documentation. The node UI is also in English.
Features at a glance
Feature What it does Status π Prompt search Find text in the prompt, highlight all matches, jump between them Stable π¨ Duplicate highlighting Repeated tags (comma-to-comma / period-to-period) get a color per group Stable β Remove duplicates One click removes repeated tags, keeping the first one Stable π¬ Comments (Ctrl+/) Comment tags in/out like in a code editor; commented tags never reach the model Stable π Min width / height Set a minimum node width and prompt-field height Stable πΎ Per-workflow settings Toolbar settings are saved inside the workflow; "Save as default" for new nodes Stable π Autocomplete friendly The prompt field is the stock ComfyUI textarea, so autocomplete add-ons keep working Stable β
Sort by category Groups tags: quality β subject β clothing β pose β β¦ π§ͺ Beta
Installation
Download the repository as a ZIP.
Extract it so that the folder
ComfyUI-CLIPTextEncodeProends up insideComfyUI/custom_nodes/.
The final layout should look like this:
ComfyUI/
βββ custom_nodes/
βββ ComfyUI-CLIPTextEncodePro/
βββ __init__.py
βββ nodes.py
βββ prompt_tools.py
βββ categories.json
βββ js/
βββ clip_text_encode_pro.js
Finish
Restart ComfyUI.
Hard-refresh the browser tab (
Ctrl+F5/Cmd+Shift+R) so the new JavaScript is loaded.Double-click the canvas, search for
CLIP Text Encode (Pro Editor)and add it.
Requirements: a recent ComfyUI with its current frontend. No extra Python packages are needed.
Quick start
Add CLIP Text Encode (Pro Editor).
Connect your CLIP (from the checkpoint loader) to the
clipinput.Connect the
conditioningoutput to your sampler's positive (or negative) input, exactly like the stock node.Type your prompt in the big text box.
Use the toolbar above the text box:
You want toβ¦ Do this Find a word in a long prompt Type it in the π search box, press Enter for the next match See repeated tags Just type: repeats are highlighted automatically, and β N shows how many groups repeat Remove repeated tags Click β Dupes Temporarily disable a tag Put the cursor in it and press Ctrl+/ Make the node bigger by default Set Min W / Min H in the second toolbar row
π¨ Duplicate highlighting & removal
What counts as a tag? Everything between two commas or two periods (a line break can also be a separator - see the setting). Periods inside numbers like 1.2 are not separators.
What counts as a duplicate? Two tags that are identical after normalization:
case is ignored (optional),
underscores = spaces (
long_hair=long hair),weights and brackets are ignored (optional):
(red hair:1.2)=red hair.
Each group of identical tags gets its own color, and all occurrences are highlighted.
retro, 1girl, retro artstyle, (smile:1.1), retro, Smile
^^^^^ ^^^^^^^^^ ^^^^^ ^^^^^
'retro' Γ2 (one color) 'smile' Γ2 (another color)
Click β Dupes to remove repeats - the first tag of each group stays:
before: retro, 1girl, retro artstyle, (smile:1.1), retro, Smile
after : retro, 1girl, retro artstyle, (smile:1.1)
Good to know:
β Dupes uses exactly the same rules as the highlight, so what you see highlighted is what gets removed.
Fragments cut out of the middle of a bracket group, like
(a, b:1.2), are never touched, so brackets can't be broken.BREAKis ignored. Commented tags are ignored too.Hover the
β Ncounter to see which tags repeat.
π¬ Comments (Ctrl+/)
Comment tags in and out like in a code editor (Cmd+/ on macOS). Works on a non-Latin keyboard layout too (it listens to the physical / key).
before: 1girl, red dress, smile
Ctrl+/: 1girl, /* red dress */, smile β cursor was inside "red dress"
Ctrl+/: 1girl, red dress, smile β toggled back
Situation Result No selection The tag under the cursor is toggled Several tags selected All tags touched by the selection are toggled Selection mixes commented and normal tags Everything becomes commented (press again to uncomment all) /* a, b */ or // β¦ comments you typed yourself Treated as one commented tag; Ctrl+/ uncomments it
Commented tags never reach the model:
The node strips
/* β¦ */and//comments itself before encoding and tidies the leftover commas (a, /* b */, cβa, c). Recent ComfyUI frontends also strip them from dynamic-prompt text boxes when queueing.The
textoutput returns the already cleaned prompt.In the editor commented tags get a gray background (the text color itself can't be changed inside a textarea).
Commented tags are ignored by duplicate detection, and they stay intact when sorting.
[!NOTE] Because
//starts a line comment, avoid writing things likehttp://β¦inside a prompt.
π§ͺ Sorting by category (BETA)
[!WARNING] Sorting is a BETA feature and still a work in progress. It is based on a keyword list, not on AI, so it will sometimes put a tag in a debatable place or push unknown tags to the end. We recommend keeping it turned off (leave
auto_sortonoffand don't use the β button) unless you are happy to review and tune the result. Everything else in this node works without it.
How it works
The prompt is split into tags by commas and line breaks. Commas inside
(),[],{},<>and inside comments do not split a tag, so(masterpiece, best quality:1.2)and<lora:name:0.8>stay whole. If the prompt containsBREAK, each block is sorted separately.Each tag is normalized for matching (brackets and trailing weight removed,
_β space, lowercase). The tag in the output keeps its original look.The tag is assigned to the first category in
categories.jsonthat has a matching keyword. Matching is by whole word/phrase:dressmatchesred dressbut notaddress.Unmatched tags go to
other, at the end.Inside each category the original order is preserved.
Category order in the result:
LoRA / embeddings β quality β subject β clothing β expression β appearance β pose β background β lighting β camera β style β other
before: red dress, 1girl, smile, masterpiece, long hair, sitting, <lora:x:0.8>, forest, best quality, from above
after : <lora:x:0.8>, masterpiece, best quality, 1girl, red dress, smile, long hair, sitting, forest, from above
π Layout settings
Min W - the node can't be made narrower than this (default
380).Min H - the prompt text box can't be shorter than this (default
160).
Both are in pixels, saved with the workflow, and can be made the default with πΎ Save as default in β.
Autocomplete compatibility
The prompt field is the stock ComfyUI multiline widget. The node never replaces, re-creates or re-parents it. Tag-autocomplete add-ons therefore see a perfectly normal prompt field, whether they attach through the widget API or watch the page for text areas.
The toolbar is a separate widget above the field, and the highlight layer is a separate element that exists only while there is something to highlight (repeats, search matches or comments). It also checks itself: if it ever ends up covering the text, it switches itself off, so your prompt always stays visible.
