Nodes/JK AceStep Nodes/AceStepSaveText
ComfyUI Node

AceStepSaveText

Auto-Incrementing Text Files From Any Node

By jeankassio·Created 9 months ago·Updated 9 months ago· 32
AceStepSaveText
    • file_path
    text
    filename_prefixtext/lyrics

    The lyrics nodes in this pack output a string, and a string sitting on a node is useless the moment ComfyUI restarts or you run fifty generations. AceStepSaveText is the pack's answer: an output node that writes any text to a .txt file in ComfyUI's output directory, with ComfyUI-style auto-incrementing filenames so you never overwrite a previous draft. It's deliberately boring, and that's the compliment.

    What it does

    Two inputs: text (what to save) and filename_prefix. The prefix defaults to text/lyrics, which means it writes to ComfyUI/output/text/lyrics_0001.txt, then lyrics_0002.txt, and so on - exactly the SaveImage naming convention, so you never clobber a file. The prefix supports folders, so lyrics/15/music creates the output/lyrics/15/ directory and writes music_0001.txt inside it.

    It's an output node (the is_output_node flag is true), so ComfyUI treats it as a terminal sink - you can right-click → "Set as loop" style behaviors and it plays nicely in the queue. The output is a file_path string, which is more useful than it looks: wire it onward if you have a node that wants to know where the file landed.

    Why it exists

    The obvious pairing is the pack's lyrics generators: drop AceStepOpenAI_Lyrics (or any of the ten) into a workflow, route its lyrics output into this node, and every generation is archived with its seed-ordered filename. It also works on any other text in your graph - prompts, negative prompts, generated metadata - since it takes a plain STRING. It's the kind of node you don't miss until the third time you lose a good lyric draft to a restart.

    Install

    Pack standard - ComfyUI Manager (search "JK AceStep Nodes") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jeankassio/JK-AceStep-Nodes.git
    

    Restart ComfyUI. It uses ComfyUI's folder_paths to find the output directory, so the files land where all your other outputs do. No extra dependencies.

    Minor gotchas

    The prefix is sanitized aggressively - characters outside A-Za-z0-9._- get replaced, and slashes act as folder separators. So keep prefixes simple; don't try to be clever with filenames, because the sanitizer will quietly rewrite them. Also, files only get written when the node actually executes - if a node upstream fails, nothing is written, and you won't get a half-empty file to remind you. That's arguably a feature. There's no timestamp or seed appended to the filename by default, so pair it with your own naming or your output folder will fill with lyrics_0042.txt with no obvious rhyme to which is which.

    CategoryJK AceStep Nodes/IO

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    filename_prefixSTRINGtext/lyrics

    Outputs (1)

    NameTypeDescription
    file_pathSTRING