Sign In

comfy-prompt-iterator

Updated: Apr 27, 2026

toolnode

Download

1 variant available

Archive Other

47.15 KB

Verified:

Type

Other

Stats

11

Reviews

Published

Apr 27, 2026

Base Model

Other

Hash

AutoV2
E3824EC6A4
default creator card background decoration
I7

i73

Comfy Prompt Iterator — ComfyUI Custom Node

A ComfyUI node that automatically steps through prompts in a text file on each generation run, so you can test multiple prompt variations without touching the graph between runs.

https://www.theoath.studio/projects/comfy-prompt-iterator


Install

cp ComfyUI/custom_nodes/
git clone [email protected]:OATH-Studio/comfy-prompt-iterator.git
# restart ComfyUI

The node appears in the node browser under utils/prompt → Prompt Iterator.


Inputs

InputTypeDescriptionprompt_fileDropdownThe text file containing prompts (one per line) from prompt_texts foldercontrol_after_generateDropdownHow to advance the prompt selection after each run


Outputs

OutputTypeDescriptionprompt_textSTRINGThe current prompt text (useful for connecting to PromptString nodes)current_indexINTOne-based index of the current prompt in the filetotal_promptsINTTotal prompts in the selected file


control_after_generate

This is the key feature. After each generation completes, the node advances its internal prompt selection according to the chosen mode:

ModeBehaviourfixedAlways uses the same prompt — nothing changes between runsincrementMoves forward one prompt each run. Wraps back to 0 after the last onedecrementMoves backward one prompt each run. Wraps to the last one after index 0randomizePicks a random prompt from the list each run

Example: You have 10 prompts in your variations.txt file. Set control_after_generate to increment. Queue 10 runs — each generation automatically uses the next prompt with zero manual intervention.


File organisation

Create a prompt_texts folder inside this custom node directory:

ComfyUI/custom_nodes/comfy-prompt-iterator/prompt_texts/
    base_prompts.txt
        a beautiful portrait of a woman, detailed face, cinematic lighting

        a beautiful landscape, sunset, mountains in background
    variations.txt
        add blur effect to the image
        add grainy film texture
        add vibrant colors and high contrast

Adding your own prompt files

  1. Create a new .txt file inside prompt_texts/ (e.g., my_prompts.txt)

  2. Add one prompt per line:

    first prompt variation here
    second prompt variation here
    third prompt variation here
  3. Empty lines are automatically ignored

  4. Restart ComfyUI or refresh the node list to see new files in the dropdown

Each .txt file should contain one prompt per line. The node will read all .txt files from prompt_texts/ and display them in a dropdown.


Typical workflow

Prompt Iterator → Prompt (or CLIPTextEncode) → KSampler → SaveImage
      ↑
  set control_after_generate = increment
  queue N runs (one per prompt variation)

Connect the prompt_text output to a Prompt node or directly to a CLIPTextEncode node's text input. This lets you automatically test multiple prompts without manually changing them between generations.


Using with filename prefix

Combine with a Filename Prefix node to organize outputs:

Filename Prefix (text from prompt_text output) → Save Image

This embeds the current prompt variation in your saved filenames for easy tracking of which prompt produced which result.