Nodes/ComfyUI-iTools/Prompt Saver
ComfyUI Node

Prompt Saver

Append a prompt to a text file, one line at a time

By MohammadAboulEla·Created 2 years ago·Updated 7 days ago· 236
Prompt Saver
      prompt
      file_pathprompts.txt

      The write half of a simple pair: this node takes a prompt string and appends it as a new line to a text file. That's it - no formatting, no dedup, no UI to browse what's already there. It's there so you can build a personal prompt library over time without ever leaving ComfyUI, and the natural partner is this pack's Prompt Loader, which reads a specific line back out of the same kind of file by index.

      How it works

      Wire a STRING into prompt, point file_path at a .txt file, run the graph, and the node appends your prompt as a new line at the end of that file. Append, not overwrite - every execution adds a line, it never touches what's already there. There's nothing to preview and nothing this node outputs back into the graph; it's a leaf node whose entire job is the side effect of writing to disk.

      The inputs and outputs that matter

      • prompt - the STRING to save. Typically wired from wherever your final prompt text lives - a CLIP Text Encode's source string, or the positive_prompt output of Prompt Styler - rather than typed by hand, since there's no multiline text box declared on this input.
      • file_path - full path to a .txt file, default prompts.txt.

      No outputs - this node is a sink, not a pass-through.

      Installing it

      Via ComfyUI Manager: search "iTools" or "ComfyUI-iTools," install, restart. Manually:

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

      then restart. No special dependencies - it's a plain text-file write.

      Troubleshooting

      File is filling up with duplicate lines. This is expected, not a bug - the node appends unconditionally on every run, so if this node sits in a workflow you queue repeatedly with the same prompt, you'll get the same line saved over and over. If you only want to save prompts you actually like, keep this node disconnected from your main run and trigger it manually (or gate it behind a switch) rather than leaving it wired permanently into every generation.

      Nothing gets written, or the node errors on save. Check that file_path points somewhere ComfyUI's process actually has write permission - a relative path like the default prompts.txt resolves against wherever ComfyUI was launched from, which may not be where you expect, and a full path into a protected system directory will fail outright.

      You're worried about where this file can be written. Worth knowing generally about ComfyUI: custom nodes run as plain Python with full filesystem access, no sandboxing - this node isn't doing anything unusual by writing to disk, it's just an explicit, visible example of the same access every node in every pack already has. Point file_path somewhere sane and it behaves exactly as described.

      You want to remove a bad entry after the fact. There's no delete or edit function on this node - it only appends. Open the .txt file directly in a text editor to clean up entries you no longer want; this node has no awareness of what's already in the file it's writing to.

      CategoryiTools

      Inputs (2)

      NameTypeDefaultDescription
      promptSTRING
      file_pathSTRINGprompts.txt

      Outputs (0)

      No outputs