Nodes/ComfyUI-Brekel/Brekel Prompt Chooser
ComfyUI Node

Brekel Prompt Chooser

Flip through saved prompts like cue cards

By Brekel·Created about a year ago·Updated 8 days ago· 19
Brekel Prompt Chooser
    • prompt
    folder_path/tmp/ComfyUI/custom_nodes/ComfyUI-Brekel/prompt_chooser
    selection_modeRandom
    seed0
    file_index0

    Say you've got a folder of prompts you actually like - the ones you spent an afternoon tuning - and you want to work through them one at a time, or grab one at random. That's this node's whole job. It reads a directory of .txt files, each holding a single prompt, and hands one back to your workflow. It's the simpler sibling of the pack's Auto Prompt Generator: instead of assembling prompts from random lines, it picks whole files.

    The pack ships a prompt_chooser folder with three examples - cat.txt, dog.txt, robot.txt - which is really just there to prove the mechanics. You'll replace them fast.

    How it works

    One file, one prompt. Every .txt file in the folder becomes a candidate, sorted alphabetically, and selection_mode decides how you pick among them:

    • Random - seeded by the seed input. Seed 0 means a different file every run, which is the "surprise me" setting for batch variety. A fixed seed reproduces the same choice.
    • Index - picks the file at file_index in alphabetical order. If the index exceeds the number of files it wraps around (file_index % file_count), so you can't actually walk off the end.

    folder_path defaults to the pack's own prompt_chooser subfolder (computed relative to the install, so it survives moving your ComfyUI around), and the error messages are refreshingly specific: no such folder, no .txt files found - it tells you exactly which case you're in.

    The inputs that matter

    • folder_path - point it anywhere you like; it doesn't have to be inside the pack. Keep your own prompt library anywhere on disk and set this to that directory.
    • selection_mode - the Random/Index switch above.
    • seed and file_index - the knobs for the two modes. Only one of them matters per run; the other just idles.

    Output

    A single STRING named prompt, containing the full text of the chosen file. Wire it into your positive prompt (or into the prompt text encoder on an LLM-encoded model) and re-run.

    Installing it

    Part of the ComfyUI-Brekel pack. ComfyUI Manager → search "Brekel" → install → restart, or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Brekel/ComfyUI-Brekel.git
    

    No extra Python packages for this node; the pack's requirements.txt exists for the LLM Prompt Enhancer only. You'll find it under the Brekel category.

    Where people get burned

    Mostly the mental model. Beginners reach for this expecting it to randomize parts of a prompt (that's the Auto Prompt Generator's job - one line per file, multiple slots). Here the unit is the whole file. Second gotcha: files are matched with .endswith(".txt") and sorted alphabetically, so name your files deliberately if you're using Index mode - "10_portrait.txt" sorts before "2_landscape.txt" and you'll be confused about which index does what. And if you edit a file, it's read fresh on every execution, so there's no caching to clear - change the file, re-run, done.

    If you're doing the bracket-trick style of prompt variation (alternatives inside {this|that}), this node isn't that. But for "flip through my curated prompt library one at a time," it's about as frictionless as it gets.

    CategoryBrekel

    Inputs (4)

    NameTypeDefaultDescription
    folder_pathSTRING/tmp/ComfyUI/custom_nodes/ComfyUI-Brekel/prompt_chooserPath to the folder containing your .txt prompt files.
    selection_modeCOMBORandomChoose 'Random' to select a file randomly based on the seed. Choose 'Index' to select a specific file.
    seedINT00–1152921504606847000
    file_indexINT00–4095The index of the file to choose when in 'Index' mode (sorted alphabetically, if index is higher than the number of files it wraps back around).

    Outputs (1)

    NameTypeDescription
    promptSTRING