Nodes/One Button Prompt/Save Prompt To File
ComfyUI Node

Save Prompt To File

Don't lose the one random prompt that actually worked

By AIrjen·Created 3 years ago·Updated about a year ago· 1,064
Save Prompt To File
      filename_prefixPrompt
      positive_prompt
      negative_prompt
      prompt_g
      prompt_l

      If you're using OneButtonPrompt for what it's for - rolling the dice until something surprises you - you're going to hit that one-in-five great result eventually, and then you'll want it back. The problem is that a purely random generator with a random seed doesn't hand you a stable record of what it just did; it's gone the moment the next run overwrites it in the node's widget. SavePromptToFile is the fix: a plain output node that writes whatever prompt text passes through it out to a file, the same way SaveImage writes pixels. It exists specifically because this pack generates so much of its text randomly - you need somewhere to catch the good ones.

      How it works

      It's a terminal node - is_output_node is true and it has no output socket, so nothing downstream connects to it. Run the graph and it writes the prompt text it received to disk, in the same output-folder convention every other ComfyUI save node follows, keyed off the filename prefix you give it.

      The inputs and outputs that matter

      • filename_prefix (required, default "Prompt") - the only thing you're likely to change. Give each project or session its own prefix so you can tell saved prompts apart later.
      • positive_prompt (required, multiline) - wire in OneButtonPrompt's prompt output, or AutoNegativePrompt's companion positive, or anything else you want on record.
      • negative_prompt (required, multiline) - wire in AutoNegativePrompt's negative_prompt output, or your own negative string.
      • prompt_g and prompt_l (optional, multiline) - the SDXL dual-encoder halves, if that's what you're running. Leave them unwired for a standard SD1.5-style setup.
      • No outputs at all - this node is a sink, not a pass-through. Nothing plugs in after it.

      How to install it

      Same pack as everything else here: ComfyUI Manager → search "One Button Prompt" → install → restart, or manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/AIrjen/OneButtonPrompt
      

      then restart ComfyUI. Pure file I/O, no models, no extra dependencies.

      Common issues & troubleshooting

      "Dangling node" or unused-output warnings. That's expected - this is meant to be a dead end in the graph. It has no output, so nothing should be connected after it. If your setup is warning you about it, the warning is about something else in the graph, not this node.

      Won't run without something plugged into positive_prompt / negative_prompt. Both are required string inputs. If you genuinely have nothing for one of them, wire in an empty string node rather than leaving it disconnected.

      The saved prompt doesn't reproduce the image later. Text alone isn't enough when the upstream generator is random - OneButtonPrompt's seed also determines the result. If you want to actually reproduce a saved prompt, note (or fix) the seed alongside it, not just the text.

      Only text is saved, not the image. This node is deliberately text-only. Pair it with a regular SaveImage node run in parallel off the same generation if you want the prompt and the picture it produced saved together.

      CategoryOneButtonPrompt

      Inputs (5)

      NameTypeDefaultDescription
      filename_prefixSTRINGPrompt
      positive_promptSTRING
      negative_promptSTRING
      prompt_goptSTRING
      prompt_loptSTRING

      Outputs (0)

      No outputs