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.
Description
# CLIP Text Encode (Pro Editor) - a smarter prompt box for ComfyUI
A drop-in upgrade for the stock CLIP Text Encode node. Search your prompt, see repeated tags highlighted, remove duplicates in one click, comment tags out with Ctrl+/, save reusable snippets, go back through your prompt history, and set your quality tags once so they are always added on top.
It is a new node, so the stock CLIP Text Encode is not touched. You can use both side by side.
No extra Python packages. Works with tag autocomplete add-ons.
---
## β¨ What it does
π Prompt search
Type in the search box above the prompt: all matches are highlighted and the current one is orange. Enter = next match, Shift+Enter = previous, Esc = clear. A counter shows 3/7.
π¨ Repeated tag highlighting
Tags (everything between two commas, or two periods) that repeat get a color, one color per group, on all occurrences. Case, underscores, weights and brackets are ignored, so (red hair:1.2) and red hair count as the same tag. A β N counter shows how many groups repeat, and hovering it lists them.
β One-click duplicate removal
The Dupes button removes repeated tags and keeps the first of each. It uses exactly the same rules as the highlight: what you see highlighted is what gets removed.
π¬ Comments with Ctrl+/
Comment tags in and out like in a code editor (Cmd+/ on Mac). Works on non-Latin keyboard layouts too.
1girl, red dress, smile -> 1girl, /* red dress */, smile
Commented tags never reach the model, show with a gray background, and are ignored by duplicate detection. Select several tags to comment them all at once.
Q Quality tags - set once, always on top
Open the settings (β), paste your usual quality tags once masterpiece, best quality, ...). From then on they are added to the top of the prompt in every Pro node. Your prompt box stays clean. Each node has a Q button to switch them off, for example on a negative-prompt node.
π Snippets
Select a block of tags (or save the whole prompt), give it a name, and insert it later with one click, at the cursor, with commas handled for you. Great for standard negatives, style blocks, characters. Insertion is undoable with Ctrl+Z.
π History
The last 30 versions of each prompt, ready to restore. A version is saved a few seconds after you stop typing and right before Dupes / snippet insert / restore. Handy for "how was it before my edits?". The current text is saved before every restore, so you can always go back.
π Layout
Minimum node width and prompt-field height are in the settings (β).
---
## π Autocomplete friendly
The prompt field is the stock ComfyUI text box. The node does not replace it, so tag autocomplete add-ons see a normal prompt field and keep working. The toolbar is a separate row above it. The highlight layer appears only when there is something to highlight, and it switches itself off if it ever covers the text, so your prompt always stays visible.
---
## π¦ Installation
1. Download the ZIP from this page.
2. Extract it so that the folder ComfyUI-CLIPTextEncodePro is inside ComfyUI/custom_nodes/.
3. Restart ComfyUI and hard-refresh the browser Ctrl+F5).
4. Double-click the canvas, search for CLIP Text Encode (Pro Editor), add it.
Requirements: a recent ComfyUI with its current frontend. No extra Python packages.
---
## π How to use
1. Add the node and connect clip from your checkpoint loader.
2. Connect conditioning to your sampler's positive or negative input, like the stock node.
3. Open β and paste your quality tags once.
4. Type your prompt. Repeated tags light up; click β Dupes to clean them.
5. Press Ctrl+/ on a tag to disable it without deleting it.
6. Use π to save and insert reusable blocks, and π to go back to an earlier version.
Toolbar: π search β βΆ β repeats β Dupes π¬ comment Q quality on/off π snippets π history β settings
Outputs: conditioning (same as the stock node) and text (the final prompt that was actually encoded: quality tags on top, comments removed).
---
## π‘ Good to know
- Turn the Q button off on negative-prompt nodes. Quality tags are on by default for every Pro node.
- Quality tags, snippets and history are stored in your browser (not in the workflow file), so they are not shared between browsers or machines, and clearing site data removes them.
- // starts a line comment, so avoid raw URLs like http://... inside a prompt.
- Changing your quality tags changes the encoded prompt, so dependent nodes re-run. Other toolbar settings do not invalidate ComfyUI's cache.
- Nodes 2.0 support is best-effort. If something misbehaves there, please tell me your ComfyUI frontend version in the comments.
---
## π Feedback
Bug reports and ideas are very welcome in the comments. Please include your ComfyUI frontend version and, if possible, a screenshot.
Version 1.0: prompt search, repeated-tag highlight, one-click dedupe, Ctrl+/ comments, global quality tags, snippets, history, min size settings.
