EVERY
PROMPT.
AUTOMATED.
A ComfyUI node that automatically steps through every prompt in a file on each generation run. Increment, decrement, randomize, or hold fixed. No rewiring. Manual switching. Queue and walk away.
Installation
cd ComfyUI/custom_nodes git clone https://github.com/OATH-Studio/comfy-Prompt-iterator
# Create prompts.txt in any location # One prompt per line, no special formatting: # prompts.txt # "a beautiful landscape at sunset" # "cyberpunk city rain night" # "portrait studio soft light"
# Find the node under loaders/text → Prompt Iterator # Wire: Prompt Iterator → KSampler (positive input)
# increment → walks every prompt in order # randomize → random prompt each run # Queue N runs and walk away.
Workflow Connection
Wire the positive_prompt output into your KSampler positive input. Each generated image is automatically named after the prompt that created it.
Features
Prompt List File
Load prompts from a simple text file with one prompt per line. Supports unlimited variations — just update the file and requeue.
Increment Mode
Steps forward one prompt after each generation. Queue 12 runs and all 12 prompts run automatically — perfect for A/B/C testing variations.
Decrement Mode
Steps backward through the list. Useful when you want to re-test in reverse order or walk back from a known good result.
Randomize Mode
Picks a random prompt from the file on each run. Good for discovery runs where you want unpredictable variation across generations.
Fixed Mode
Locks to the current selection and never advances. ComfyUI caches the patched model so it does not reload unnecessarily between runs.
IS_CHANGED Aware
Uses IS_CHANGED correctly — non-fixed modes always re-execute so the index actually advances. Fixed mode returns a stable hash so caching still works.
Mode Behaviour
Each mode determines which prompt is selected on the next run. State is tracked per node instance so multiple nodes in the same graph iterate independently.
Node Inputs
Node Outputs
Prompt File Format
Create a simple text file with one prompt per line. The node reads the file on startup and builds an index for iteration. Blank lines and comments (starting with #) are automatically skipped.
Example File (prompts.txt)
# Variation 1 - Soft lighting a beautiful landscape at sunset with golden hour lighting # Variation 2 - Dramatic clouds cyberpunk city rain night with dramatic storm clouds # Variation 3 - Portrait style portrait studio soft light professional photography # Variation 4 - Abstract abstract fluid art vibrant colors swirling patterns
Result
The node loads all non-blank, non-comment lines and presents them as an iterable list. Edit the file anytime — changes take effect on next generation run.
FAQ
Can I have multiple Prompt Iterator nodes in one graph?
+Yes. Each node instance tracks its own index independently using ComfyUI's unique_id hidden input. Two nodes set to increment will walk through their respective prompt files separately without interfering with each other.
What happens when it reaches the last prompt?
+It wraps. Increment goes back to index 0, decrement goes back to the last index. You can queue more runs than you have prompts and it will cycle through again from the start.
How do I format my prompt file?
+Simple text file with one prompt per line. Blank lines are ignored. Comments starting with # are skipped. No special formatting required — just clean text.
Can I iterate negative prompts too?
+Yes, add another Prompt Iterator node and connect its positive_prompt output to your KSampler negative input. Each node maintains independent state.
Does fixed mode reload the file every run?
+No. Fixed mode returns a stable hash from IS_CHANGED so ComfyUI sees no change and uses its cached output. The prompt is not re-read on every run, which is the correct behaviour for a static selection.
Need Custom
AI Tooling?
This node is a small example of what we build. We design and develop custom AI pipelines, local inference tooling, ComfyUI integrations, and production workflows for studios and independent creators who want control over their stack.
- Custom ComfyUI nodes and workflow automation
- Local LLM integration and prompt engineering
- vLLM / Ollama deployment and optimisation
- End-to-end AI image and video pipelines
- On-premise — your hardware, your data
Technical details
Free · Open Source · MIT License
QUEUE IT.
WALK AWAY.
Built by OATH Studio. We make open tools for AI artists and studios, and take on custom development work for teams who need something specific. No cloud dependencies. No subscriptions.