Nodes/Boyonodes/Boyo Prompt Loop
ComfyUI Node

Boyo Prompt Loop

Batched Prompts From a Text File, Sequenced for Loops

By DragonDiffusionbyBoyo·Created 2 years ago·Updated 26 days ago· 16
Boyo Prompt Loop
    • prompt_config
    text_file
    mode
    start_seed0
    loop_count5
    prefix
    suffix
    single_prompt

    The one prompt per queue run grind gets old fast. If you've got 20 prompts you want to run through the same workflow, you shouldn't be clicking "Queue" 20 times. BoyoPromptLoop is the front half of a prompt-batching setup: it reads a list of prompts from a .txt file and packages them into a config object that a loop can walk through one at a time. The back half is BoyoPromptInjector, which actually hands each prompt to your sampler on the right iteration.

    What it does

    It has a text_file dropdown listing the .txt files in the pack's prompts/ folder, and a mode:

    • sequential - walks the list in order, starting from start_seed as an offset and wrapping when it hits the end.
    • random - picks prompts in a seeded, reproducible random order. Same start_seed, same sequence, every run.
    • single - ignores the file and repeats one single_prompt for every pass. Good for a "same prompt, different seed/denoise" sweep.

    loop_count (default 5) controls how many prompts get generated into the config. There are also prefix and suffix strings that get wrapped around every prompt - handy for appending a consistent style tag or negative-adjacent context to a list of short prompts.

    How it works under the hood

    The first time the node loads, it creates the prompts/ folder inside the pack directory and writes a sample_prompts.txt so the dropdown isn't empty. Each line of your file becomes one prompt (blank lines are skipped; empty file falls back to three placeholder prompts). The output is a single PROMPT_LOOP_CONFIG object - not a string. That's important: you can't plug this directly into a text encoder. It's a container you hand to BoyoPromptInjector, which extracts the per-iteration prompt.

    # inside ComfyUI/custom_nodes/Boyonodes/prompts/
    # one prompt per line:
    a cinematic portrait, golden hour
    a cinematic portrait, blue hour
    a cinematic portrait, rain
    

    Where it fits

    This is built for the pack's "bastard loops" - genuine iterative loops around a sampler. Wire prompt_config from this node into BoyoPromptInjector, feed the injector your loop counter, and each loop pass samples a different prompt automatically. Pair it with a folder-based image saver and you've got a batch-run harness without any scripting.

    Installing it

    Ships with Boyonodes (DragonDiffusionbyBoyo):

    cd ComfyUI/custom_nodes
    git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
    

    Restart ComfyUI or install "Boyonodes" via ComfyUI Manager. No extra Python deps for this node.

    Gotchas

    • The prompts/ folder lives inside the pack directory (custom_nodes/Boyonodes/prompts/), not your ComfyUI root. People look in the wrong place constantly.
    • random mode re-seeds per iteration internally, so it's reproducible but not a true shuffle without replacement - you can get repeats within one batch.
    • The dropdown refreshes at load time; if you add a file while ComfyUI is running, restart or reload the node.

    It's the "list of prompts in, loop-ready config out" piece of the puzzle - boring, but it turns a 20-queue day into one run.

    Categoryboyo/bastardloops

    Inputs (7)

    NameTypeDefaultDescription
    text_fileCOMBO1 options: sample_prompts.txt
    modeCOMBO3 options: sequential, random, single
    start_seedINT00–4294967295
    loop_countINT51–100
    prefixoptSTRING
    suffixoptSTRING
    single_promptoptSTRING

    Outputs (1)

    NameTypeDescription
    prompt_configPROMPT_LOOP_CONFIG