CivArchive
    ComfyUi Advansed Prompting - v1.0
    Preview 149835568

    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

    1. Download the repository as a ZIP.

    2. Extract it so that the folder ComfyUI-CLIPTextEncodePro ends up inside ComfyUI/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

    1. Restart ComfyUI.

    2. Hard-refresh the browser tab (Ctrl+F5 / Cmd+Shift+R) so the new JavaScript is loaded.

    3. 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

    1. Add CLIP Text Encode (Pro Editor).

    2. Connect your CLIP (from the checkpoint loader) to the clip input.

    3. Connect the conditioning output to your sampler's positive (or negative) input, exactly like the stock node.

    4. Type your prompt in the big text box.

    5. 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.

    • BREAK is ignored. Commented tags are ignored too.

    • Hover the ⚠ N counter 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 text output 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 like http://… 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_sort on off and 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

    1. 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 contains BREAK, each block is sorted separately.

    2. Each tag is normalized for matching (brackets and trailing weight removed, _ β†’ space, lowercase). The tag in the output keeps its original look.

    3. The tag is assigned to the first category in categories.json that has a matching keyword. Matching is by whole word/phrase: dress matches red dress but not address.

    4. Unmatched tags go to other, at the end.

    5. 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

    Other
    Anima

    Details

    Downloads
    13
    Platform
    CivitAI
    Platform Status
    Available
    Created
    11/22/2026
    Updated
    11/22/2026
    Deleted
    -

    Files

    ComfyUI-CLIPTextEncodePro (2).zip

    Mirrors