Nodes/Prompt Folder/Prompt To Folder
ComfyUI Node

Prompt To Folder

The save button ComfyUI never had for prompts

By nzkritik·Created 26 days ago·Updated 26 days ago· 1
Prompt To Folder
    • file
    ◄prompt—►
    ◄foldersaved►
    ◄name—►

    Your prompt enhancer just wrote you a genuinely good prompt. It's sitting in a string socket in the graph, and there is nowhere to put it. Copy it out by hand, into a notes app, forever. Prompt To Folder is the write side of that problem: it takes a string and saves it as a numbered .txt file under ComfyUI/input/prompts/, in exactly the shape the pack's other node reads back.

    The timing matters, because prompt enhancers stopped being a novelty - corpus mentions of "prompt enhancer" ran 12 in 2023 and 253 in the first half of 2026, and every one of those generations produces text that evaporates. This node catches it. The simpler, probably more common use: you vary one phrase across twenty runs, one image is great, and you want the prompt that made it in a file you can re-run next week.

    How it works

    It's an output node, which is what makes it run at all: ComfyUI identifies output nodes and works backward from them, re-executing only what might have changed. An output node always fires, so nothing needs to be downstream of it.

    It also opts out of the cache on purpose: its fingerprint is the current time in nanoseconds, so the engine sees a changed node on every run and writes again even when the prompt is byte-identical - the same trick family as the NaN fingerprint, with a friendlier value. That's the feature and the footgun in one sentence.

    Writing is deliberately paranoid, because a node that creates files at the request of a web frontend is a node anything on your LAN can drive. Folder components are cleaned into plain path names, .. is refused outright, /etc becomes an ordinary subfolder under input/prompts, characters that are unsafe in filenames (including :) become _, and Windows reserved names get an underscore. The file itself is created with O_CREAT|O_EXCL|O_NOFOLLOW: an existing file is never overwritten, and a symlink planted at the target is never written through. The number just goes up, and nothing lands outside input/prompts/.

    Inputs and outputs

    • prompt - the text to save. Wire the same string you send to CLIP Text Encode. Fair warning: in the source this input is force_input, so it renders as a socket, not a text box - you can't type into it. Want to type? Put a string primitive in front.
    • folder - defaults to saved, created if missing. Type saved/portraits and the slash makes subfolders. Browse… lists folders that already exist under input/prompts/; you can also type a new name into its filter box and press Enter. Depth caps at 8 levels.
    • name (optional) - the filename prefix, numbered exactly like Save Image, so portrait_00001.txt, portrait_00002.txt. A / in it makes subfolders too. Leave it empty for the default prefix, prompt. It's a socket as well, not a text field.

    The single output is file, the path relative to input/prompts/ - saved/portrait_00003.txt. Nothing needs to consume it; it's there for logging, or for a Note node if you want to read back what the last run produced.

    Install

    Manager → search Prompt Folder, or:

    comfy node install comfyui-prompt-folder
    

    Manual install, if the registry listing hasn't shown up for you yet:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nzkritik/comfyui-prompt-folder
    

    Restart ComfyUI. Zero Python dependencies, so there's nothing to break in your environment. One requirement to check: the pack is written against ComfyUI's V3 node API, so it needs 0.3.48 or newer. On an older build the nodes simply won't appear.

    Where people get burned

    "Why is my folder full of the same prompt?" Because writing every run is the design. Queue five runs and you get five numbered files, identical text. If that's not what you want, mute (Ctrl+M) or bypass (Ctrl+B) the node - bypassing an output node stops it running - rather than deleting it from the graph.

    An empty string fails the run. The node raises the prompt is empty; nothing to save. If an LLM node upstream occasionally returns nothing, that failure surfaces here and takes the whole run with it, so keep a fallback string wired in.

    Numbering only counts files that match. It looks for prefix_NNNNN.txt, so hand-named files like prompt.txt don't get overwritten or skipped over - the counter just continues past whatever numbered files are already there. The counter is per-folder and per-prefix, so two different name values in the same folder number independently.

    Mind the pair with the reader. Files land in input/prompts/, which is precisely where Prompt From Folder reads, and since that node sorts names naturally, prompt_00001.txt through prompt_00009.txt play back in the order you wrote them. That's the loop: enhance, save, then queue a batch off the folder weeks later. Save winners into a named folder like keepers/ and leave the default saved/ for experiments - a folder of prompt_NNNNN.txt gets unreadable fast.

    LAN exposure. With --listen, anyone who can reach your ComfyUI can drive these nodes, including this one - creating folders and files under input/prompts/. Confined to that tree, but it's a writer, so it's worth caring about.

    Altogether this is a small node with no model, no dependencies and no ceremony. It's the half of the pack that stops the other half from being a manual chore.

    Categoryutils/Prompt Folder

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRINGThe text to save.
    folderSTRINGsavedA folder under ComfyUI/input/prompts, e.g. 'saved' or 'saved/portraits'. Created if missing. Use Browse to pick an existing one.
    nameoptSTRINGFile name prefix, numbered like Save Image (name_00001.txt). A '/' makes subfolders. Defaults to 'prompt'.

    Outputs (1)

    NameTypeDescription
    fileSTRING—