Nodes/ComfyUI_Eclipse/Read Prompt Files
ComfyUI Node

Read Prompt Files

One Prompt Per Line, a Thousand Runs Per List

By r-vageΒ·Created 10 months agoΒ·Updated a day agoΒ· 31
Read Prompt Files
    • prompt
    β—„file_pathsβ–Ί
    β—„index0β–Ί
    β—„stop_at_endtrueβ–Ί
    β—„log_promptfalseβ–Ί
    β—„seed_inputβ€”β–Ί

    What it is

    Read Prompt Files turns a plain text file into a prompt source. You point it at one or more text files, it reads every line as a prompt, and it hands back one selected line as a string - with the selection modes you actually want for batch work: fixed index, random, increment, decrement, or shuffle-without-repeat.

    If you've ever run a batch where every image needed a different prompt and you hand-edited the widget between runs, this is the node that kills that habit. Keep the prompts in a text file, let the node walk through them, and the workflow becomes a fire-and-forget batch.

    How it works

    Each line of each file becomes one prompt (empty lines are skipped, and you can list multiple files - one path per line, quotes stripped automatically). All the lines across all files are pooled into one list, and the index widget picks from it.

    The index modes are the heart of it: 0+ is a fixed position, -1 randomizes each run, -2 increments to the next line, -3 decrements, and -4 shuffles with no repeats until you've seen the whole list. With stop_at_end on, incrementing past the last line (or decrementing past the first) stops the workflow instead of wrapping - so a batch run ends cleanly when the prompt list runs out, rather than silently repeating.

    Two details make it pleasant to live with. The seed_input socket, when connected, makes the special modes only advance when that value changes - keep the same seed and the same prompt stays selected while you tweak other settings, which is exactly what you want when you're iterating on a specific prompt. And it caches file contents keyed on modification time, so editing your text file mid-session is picked up without a full re-read of everything downstream.

    The inputs that matter

    • file_paths - the text files, one per line.
    • index - selection mode and position: 0+ fixed, -1 random, -2 increment, -3 decrement, -4 shuffle.
    • stop_at_end - whether running off the end halts the workflow.
    • seed_input (optional) - freeze prompt selection while the seed is unchanged.
    • log_prompt - print the selected prompt to the console for debugging.

    Output: prompt - a single STRING, ready to feed a text encoder or a text concat node.

    When you'd use it

    Batch generation with per-image prompts is the flagship case - write your fifty prompts in a file, queue a batch of fifty, walk through them with increment mode. It's also great for random prompt sampling over a large curated list, and for keeping prompts under version control in plain text instead of buried in workflow JSON.

    Installing it

    It's part of ComfyUI_Eclipse:

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

    then restart, or install via Manager (search "Eclipse"). Pack history note: formerly RvTools_v2, legacy nodes removed in v4.0.0 - use the bundled migration tool on old graphs.

    Common issues

    The usual beginner stumble is path errors: the node warns and skips any file it can't find, so a typo just silently shortens your list. Check the console for "File not found" lines. Also remember it reads lines, so a prompt wrapped across two lines becomes two prompts - keep one prompt per line. And if increment mode hits the end and nothing happens, check stop_at_end; with it off the behavior is to wrap, which surprises people who expected it to stop.

    CategoryπŸŒ’ Eclipse/ Text

    Inputs (5)

    NameTypeDefaultDescription
    file_pathsSTRINGFile paths, one per line. Quotes are automatically removed.
    indexINT0-4–999999Prompt index: 0+ = fixed position, -1 = random, -2 = increment, -3 = decrement, -4 = shuffle (no repeat)
    stop_at_endBOOLEANtrueStop workflow when increment reaches end or decrement reaches start. Does not apply to random mode.
    log_promptBOOLEANfalsePrint the selected prompt to console for debugging
    seed_inputoptINTWhen connected, special index modes (-1/-2/-3/-4) only advance when this value changes. Keep the same seed to freeze prompt selection while tweaking other workflow settings.

    Outputs (1)

    NameTypeDescription
    promptSTRINGβ€”