ComfyUI Node

Prompt Feeder

Point it at a folder of prompts and walk away

By ketle-man·Created 8 days ago·Updated 2 days ago· 0
Prompt Feeder
    • STRING
    mode
    text
    source_rootprompt-feeder-data
    directory
    sort_mode
    index0
    start_index0
    end_index0
    seed0
    use_selectiontrue
    selected_files[]
    file

    You've got a flat file of 80 prompts you scribbled while iterating, and you want one image per prompt - not 80 images of the same paragraph. The usual ComfyUI answer is wildcard syntax ({blonde|brunette}, __wildcard__, the stuff Impact Pack quietly owns), which varies tokens inside one prompt within a single run. Prompt Feeder solves the other problem: one prompt per queued run, so every line is its own job with its own seed and its own output file.

    What it actually is

    One node that holds a list of prompts and hands you one STRING at a time, plus a browser-side controller that drives the queue while you make coffee. You feed it three ways: type them straight into the node (edit mode), point it at a folder of .txt files and feed those line by line (library mode), or pick one file and loop a line range within it (single_file mode).

    How the loop actually works

    The node is registered as an output node in the source (OUTPUT_NODE = True) - output nodes are the ones ComfyUI's executor never caches away, so this genuinely runs every time the graph runs. On each run it resolves your list, returns the line at index as a plain string, and pushes a websocket message carrying the next index, whether one exists, and a preview. The bundled frontend JS listens for that: if you've pressed ▶ Run, it writes the next index into the index widget and queues one more job about half a second later.

    So the loop lives in the browser and the websocket, not in the backend. Two practical consequences:

    • Each iteration is an ordinary one-job queue, so it behaves like you pressing Queue yourself. ComfyUI caches aggressively and works backward from the output nodes, re-running only what changed - text encode, sampler - instead of reloading the checkpoint 80 times.
    • Each iteration is a fresh run, so KSampler's control_after_generate applies per prompt. Leave it on randomize and every prompt gets its own seed - but set "widget control mode" to Before in ComfyUI's settings first, or the seed you see isn't the seed that just ran.

    Because the frontend issues the next queue, keep the tab open. Close it mid-loop and the chain stops where it is.

    The inputs you'll actually touch

    Most of these are mode-dependent - the node dims what doesn't apply, and values survive a mode switch.

    • mode - edit, library, or single_file. Everything downstream depends on this one.
    • text - your prompts, one per line, empty lines ignored. Only edit mode.
    • directory + source_root - which subfolder inside your data source to read. source_root starts as prompt-feeder-data and gains an entry for every external path you register.
    • file - one filename (e.g. hero.txt). Its tooltip is the map: start_index/end_index then select a line range inside that one file.
    • sort_mode - ascending, descending, or random. Random is reproducible via seed, and file names sort naturally, so a10.txt lands after a9.txt.
    • index, start_index, end_index, seed, use_selection, selected_files - mostly automation real estate. Run resets index to 0 and advances it for you. end_index = 0 means "to the end."

    Output is a single STRING: wire it into CLIP Text Encode's text box.

    Install

    Manager → search "Prompt Feeder", or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ketle-man/comfyui-prompt-feeder
    # keep the folder name as comfyui-prompt-feeder
    # restart ComfyUI
    

    There are no pip dependencies and no models - the pyproject.toml declares none, and the code uses only what ComfyUI already ships (folder_paths, server.PromptServer). In a category where installing anything usually means a dependency conflict, that's the nicest thing about this pack.

    Prompts live here, and folders inside it work fine:

    ComfyUI/user/default/prompt-feeder-data/
    ├── character/
    │   ├── eyes.txt
    │   └── hair.txt
    └── sample.txt
    

    Files must be UTF-8, .txt, and 100KB or smaller. The library UI (📂 Lib) browses and edits them, and its ⚙ button registers other packs' text folders as read-only sources - path traversal is blocked and symlinks are skipped.

    Where people get burned

    The one that catches everyone: in library mode, start_index/end_index count files, not lines. Two files of three lines each with start_index=1 means "start at the second file," i.e. the fourth prompt overall. In single_file mode those same fields become a line range. The preview counter (2 / 6) is your ground truth for how many prompts the node thinks it has.

    Smaller stuff: blank-only text in edit mode errors out rather than producing nothing, and a freshly registered external path sometimes won't show up in the source_root dropdown until you reload the page.

    Should you reach for it

    Honest framing: this is a small hobby pack with essentially no community footprint - no Reddit threads, nobody to ask. What you get in exchange is ~700 lines of readable MIT Python, zero dependencies, and a UI more thought-out than most one-person packs. If your job is "run this list of prompts overnight," reach for it. If your job is "vary a word inside one prompt," reach for wildcards instead.

    Categorytext

    Inputs (12)

    NameTypeDefaultDescription
    modeCOMBO3 options: edit, library, single_file
    textSTRINGOne prompt per line. Empty lines are skipped.
    source_rootCOMBOprompt-feeder-dataData source. Registered external paths (via the library's ⚙ Settings) are read-only (for reusing existing prompt/wildcard .txt files from other node packs).
    directorySTRINGSubfolder name within the selected source_root. Leave empty to use its root directory.
    sort_modeCOMBO3 options: ascending, descending, random
    indexINT00–18446744073709550000
    start_indexINT00–18446744073709550000
    end_indexINT00–18446744073709550000
    seedINT00–18446744073709550000
    use_selectionBOOLEANtrue
    selected_filesSTRING[]
    fileSTRINGFilename (e.g. hero.txt) within the directory above. Used in single_file mode; start_index/end_index then select a line range within this file.

    Outputs (1)

    NameTypeDescription
    STRINGSTRING