Nodes/ComfyUI-KikoTools/Batch Prompts
ComfyUI Node

Batch Prompts

Render Every Prompt in a File Without Touching the Queue

By ComfyAssetsΒ·Created about a year agoΒ·Updated 2 months agoΒ· 19
Batch Prompts
    • positive
    • negative
    • full_prompt
    • next_prompt
    • current_index
    • total_prompts
    • batch_info
    β—„prompt_fileprompts.txtβ–Ί
    β—„index0β–Ί
    β—„auto_incrementtrueβ–Ί
    β—„wrap_aroundtrueβ–Ί
    β—„split_negativetrueβ–Ί
    β—„reload_filefalseβ–Ί
    β—„show_previewtrueβ–Ί

    The tedium of prompt testing is pasting a new prompt, queuing, waiting, pasting again. Batch Prompts automates the pasting: it reads a list of prompts from a text file and hands them to your workflow one at a time, advancing automatically on every run. Queue it once and let it chew through your whole list.

    How it works

    You keep a plain text file where prompts are separated by a line of three dashes (---):

    a red convertible at golden hour
    ---
    a blue sedan in the rain, Negative: rainy windshield, fog
    ---
    a vintage motorcycle, studio lighting
    

    The node loads the file, picks the prompt at the current index, and - the important part - increments that index after every execution. Each time you queue, you get the next prompt. Two flags control the loop: wrap_around sends you back to prompt #1 after the last one instead of dying, and auto_increment (on by default) is what makes it self-advancing in the first place; turn it off and it just holds a fixed index so you can step manually.

    If split_negative is on (it is by default), it looks for a Negative: marker and splits the entry into separate positive and negative strings. That's the SDXL-style convention, and it saves you from hand-editing the file into two columns.

    Inputs and outputs

    The ones that matter:

    • prompt_file - path to the text file. Relative paths resolve against ComfyUI's input directory, so a default of prompts.txt means ComfyUI/input/prompts.txt. Absolute paths work too.
    • index - the current 0-based position. Setting it manually jumps straight to a specific prompt.
    • reload_file (optional) - force a re-read from disk if you edited the file mid-run.

    Outputs are the useful part: positive, negative, and full_prompt feed your text encoders; next_prompt shows what's coming up; and current_index / total_prompts / batch_info are there for conditioning or just for you to see where you are.

    Installing it

    It's part of the ComfyUI-KikoTools pack. ComfyUI Manager β†’ search "ComfyUI-KikoTools" β†’ Install β†’ restart, then look under ComfyAssets β†’ Text. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ComfyAssets/ComfyUI-KikoTools.git
    cd ComfyUI-KikoTools
    pip install -r requirements.txt
    

    Restart ComfyUI. No models, no keys.

    Gotchas

    Three things bite people. First, file location: a bare filename like prompts.txt is looked up in ComfyUI/input, not next to your workflow - people drop the file somewhere else and get "No prompts found." Second, the separator must be at least three dashes; if your file has a stray line that doesn't split cleanly, the node treats it as part of the previous prompt. Third, split_negative only fires on the literal Negative: marker - if you used "negative prompt:" or a different label, you'll get everything dumped into positive. Also worth knowing: because each run uses a fresh file read unless you toggle reload_file, editing the file mid-batch sometimes needs a manual reload to take effect.

    Category🫢 ComfyAssets/πŸ“ Text

    Inputs (7)

    NameTypeDefaultDescription
    prompt_fileSTRINGprompts.txtPath to text file containing prompts separated by '---'
    indexINT00–9999Current prompt index (0-based)
    auto_incrementBOOLEANtrueAutomatically increment index after each execution
    wrap_aroundBOOLEANtrueWrap to first prompt after reaching the end
    split_negativeBOOLEANtrueSplit prompts into positive/negative at 'Negative:' marker
    reload_fileoptBOOLEANfalseForce reload file from disk
    show_previewoptBOOLEANtrueShow prompt preview in console

    Outputs (7)

    NameTypeDescription
    positiveSTRINGβ€”
    negativeSTRINGβ€”
    full_promptSTRINGβ€”
    next_promptSTRINGβ€”
    current_indexINTβ€”
    total_promptsINTβ€”
    batch_infoSTRINGβ€”