ComfyUI Node

Prompt Cycler

Queue a hundred prompts without touching the workflow again

By tenitsky·Created 10 months ago·Updated 10 months ago· 10
Prompt Cycler
    • prompt
    • cycle_index
    seed0
    cycle_modesequential
    reset_cyclefalse
    custom_promptsA majestic mountain landscape at sunset with golden light A futuristic city with flying cars and neon lights A peaceful forest with sunlight filtering through trees An underwater scene with colorful coral reefs and fish A cozy cabin in the woods during winter snowfall A space station orbiting a distant planet A bustling marketplace in an ancient city A serene lake with mountains reflected in the water A steampunk laboratory with brass gears and steam A magical garden with glowing flowers and butterflies

    Prompt Cycler is the node for the most boring job in ComfyUI: handing a different prompt to each run of the same workflow. In vanilla ComfyUI your prompt text is baked into the graph, so "generate 40 images, each with its own idea" means re-typing between queues or building some wildcard/load-from-file contraption. This little node just gives you the next line in a list every time the workflow executes. The author (Anton Tenitsky) said on r/comfyui that he runs 100–200 prompt lists through it daily, and honestly that's the whole pitch: it's a text list with a counter bolted on, and that's all it needs to be.

    It's not a workflow-included showpiece and it calls no API, needs no key, and ships no model files - the entire install dependency is torch>=1.9.0, which you already have. Where it shines is bulk generation: character-reference sheets, LoRA dataset harvesting, style studies, "generate 50 thumbnails and pick the good ones." One commenter on the release thread grabbed it for an automated LoRA dataset generator.

    How it actually works

    The node is stateful. On each execution it returns the current prompt, then advances an internal counter; when it runs past the end of the list it wraps back around, so "infinite cycling" is really just modulo arithmetic. Two modes:

    • sequential - walks the list in order, wrapping at the end.
    • random - picks an index at random each time.

    One detail in the source is why it works at all: its IS_CHANGED returns float("nan"), which forces ComfyUI to re-execute the node on every queue. Node results are cached by default, so without that trick the node would compute prompt #1 once and freeze there. Good instinct, and it's the reason cycling behaves even in a normal queue.

    The state lives on the node instance, which is a gotcha worth knowing: save the workflow, reload it, or restart ComfyUI, and the counter starts back at zero. That's usually fine - for reproducibility it's arguably a feature - but don't expect a long-running batch to survive a restart mid-way.

    The inputs that matter

    Only three settings are worth touching, plus the prompt list:

    • custom_prompts - a multiline box, one prompt per line, where you paste your real list. It pre-fills with ten example prompts (mountains, neon cities, underwater reefs, the usual), so replace them. There's no file loader here: the author explicitly chose "copy-paste from ChatGPT into the field" over text-file support.
    • cycle_mode - sequential or random. Sequential for consistent batches, random for variety.
    • reset_cycle - a checkbox that zeroes the counter. Trap: if you leave it checked, every queue resets before it returns, so you'll be stuck on prompt #1 forever. Tick it once, run, untick it.
    • seed - 0 means no seed. Here's the quirk: a nonzero seed re-seeds Python's RNG at the start of every execution, so in random mode with a fixed seed you get the same random pick every queue. If you want random variety, leave it at 0.

    Outputs and wiring

    • prompt (STRING) - the current prompt. Wire it into a CLIP Text Encode node's text input, same as you would type there by hand, and you're done: Prompt Cycler → CLIP Text Encode → KSampler → VAE Decode → Save Image.
    • cycle_index (INT) - the zero-based index of the prompt that fired. Mostly useful if you want to log or branch on which prompt produced which image.

    You can also chain multiple cyclers to combine dimensions - the author's own tip is running one list of 200 locations and another of 7 animals in parallel, which keeps them cycling out of sync.

    Install

    Easiest is ComfyUI Manager: search for tenitsky-prompt-cycler-simple (it's titled "ComfyUI Prompt Cycler Node") and install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tenitsky/tenitsky-prompt-cycler-simple.git
    cd tenitsky-prompt-cycler-simple
    pip install -r requirements.txt
    

    Then restart ComfyUI. The node appears under text/prompt. No model downloads, nothing heavy - the pip install is basically a no-op since torch is already there.

    Gotchas, collected

    • Leaving reset_cycle checked pins you to the first prompt.
    • Random mode + nonzero seed = same "random" pick every time.
    • No file input - paste your list in, one per line.
    • Cycle state resets when the workflow reloads.

    It's not the most sophisticated node on your graph, but for cranking out a big prompt-varied batch it's one of the most genuinely useful. Stick a list in, queue, go make tea.

    Categorytext/prompt

    Inputs (4)

    NameTypeDefaultDescription
    seedINT00–18446744073709550000
    cycle_modeCOMBOsequential2 options: sequential, random
    reset_cycleBOOLEANfalse
    custom_promptsoptSTRINGA majestic mountain landscape at sunset with golden light A futuristic city with flying cars and neon lights A peaceful forest with sunlight filtering through trees An underwater scene with colorful coral reefs and fish A cozy cabin in the woods during winter snowfall A space station orbiting a distant planet A bustling marketplace in an ancient city A serene lake with mountains reflected in the water A steampunk laboratory with brass gears and steam A magical garden with glowing flowers and butterfliesEnter your own prompts, one per line. Default shows example prompts.

    Outputs (2)

    NameTypeDescription
    promptSTRING
    cycle_indexINT