Nodes/ZF-ComfyUI-Helper/ZF Save TXT (Timestamp)
ComfyUI Node

ZF Save TXT (Timestamp)

Save a prompt to TXT with a timestamp, and never overwrite anything

By Z-yaofang·Created 2 months ago·Updated 19 days ago· 1
ZF Save TXT (Timestamp)
    • text
    • file_path
    text
    directoryTXT
    filename_prefixreverse_prompt

    If you've ever wanted to log every prompt you generate - for comparison, for bookkeeping, for the "wait, which negative prompt got me that result" moment - you know the built-in options are awkward. ZFSaveTextTimestamped (display name "ZF Save TXT (Timestamp)") is a tiny output node that does one thing well: it writes whatever text you feed it to a UTF-8 .txt file with a timestamp in the name, so files never collide and your history piles up instead of overwriting itself.

    It's part of ZF-ComfyUI-Helper, the no-dependency utility pack, under ZF Helper/Text.

    The three inputs

    • text - what to save. It's a forced input (a wire, not a widget), and multiline, so blank lines and line endings survive intact. The default prefix in the pack is reverse_prompt, which tells you the author's own use case: log the negative prompt per run.
    • directory - where to save. Relative paths (default TXT) resolve below ComfyUI's output folder, so TXT becomes ComfyUI/output/TXT/. Absolute local paths work too. Folders are created automatically.
    • filename_prefix - the name stem; the node appends the local timestamp and .txt. You get reverse_prompt_2026-07-23_23-45-12.txt. If two files land in the same second, a numeric suffix is added so nothing is ever silently overwritten.

    The details that make it trustworthy

    Three behaviors are worth knowing because they're the difference between a logging node you trust and one you fight:

    • A string list gets written as one file. If the upstream node gives you a ComfyUI string list (say, a batch of prompts), the whole list is written in order into a single TXT with newlines between items - not one file per item, which would be chaos.
    • Relative paths are locked inside the output folder. If you type ../something, the node refuses rather than writing outside output/. To save elsewhere you use an absolute path - a small safety guard that prevents "where did my text go" surprises.
    • It always runs. IS_CHANGED returns NaN, the standard trick for forcing a node to execute every run regardless of caching. For an output node that's exactly what you want - you asked it to log, it logs, every time.

    Outputs

    text (the exact text that was written - convenient for chaining a save into a display node) and file_path (the actual absolute path of the file, so you could feed it into a loader or a note). It's marked as an output node, so it runs and terminates the graph from its position.

    Installing it

    Trivial - the pack has zero dependencies:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Z-yaofang/ZF-ComfyUI-Helper
    

    Restart ComfyUI, or search ZF-ComfyUI-Helper in ComfyUI Manager. No models, no requirements.txt.

    Where people get caught

    The usual stumble is forgetting that relative directory values are resolved from ComfyUI's output folder, so TXT lands at ComfyUI/output/TXT, not next to your ComfyUI executable. And a couple of character-class gotchas are handled for you - illegal filename characters in the prefix get replaced with underscores - so you mostly can't break the filename. The real advice is to wire the file_path output somewhere visible the first run, so you see where the file went before you trust it. One timestamped TXT per run is a small habit that pays off the first time you need to compare last week's prompt against today's.

    CategoryZF Helper/Text

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGText to save as a UTF-8 .txt file.
    directorySTRINGTXTRelative paths are created under the ComfyUI output folder. Absolute local paths are also supported.
    filename_prefixSTRINGreverse_promptFilename prefix. A local timestamp and .txt extension are added automatically.

    Outputs (2)

    NameTypeDescription
    textSTRING
    file_pathSTRING