Nodes/RF Nodes/Save prompt to file
ComfyUI Node

Save prompt to file

Your whole workflow, auto-saved to disk on every run

By foxtrot-roger·Created 3 years ago·Updated 2 years ago· 2
Save prompt to file
      filename_prefixComfyUI
      indent20

      One of the oldest annoyances in ComfyUI is that your "prompt" isn't a text box - it's the entire graph. The positive prompt, the negative, the seed, the sampler settings, all of it lives inside the workflow, and most of the time the only record you get is whatever gets baked into the PNG metadata. RF Save Prompt Info (class RF_SavePromptInfo) fixes that the boring way: every time you run the graph, it dumps the full workflow as a JSON file into your output folder.

      That's more useful than it sounds. Keep the JSON per run and you can diff two runs to see exactly what changed, archive experiments without digging through image metadata, or feed the file to a script that tracks seeds and settings across a long batch. It's the reproducibility habit that ComfyUI's workflow-sharing culture almost demands - the ecosystem lives on "workflow included" - except now the workflow is saved by you, for you, without dragging PNGs anywhere.

      How it works

      The node is an output node with no visible inputs and no outputs. What you don't see is a hidden prompt input - ComfyUI injects the current workflow graph into it automatically, so you just drop the node onto the canvas and it works. On each execution it writes a file named like ComfyUI_00001_.json into ComfyUI/output/, using the same folder and counter machinery as the standard Save Image node, then pretty-prints the workflow with json.dumps(prompt, indent=indent).

      Because the node only runs when the graph runs, it's a natural end-of-workflow sentinel. It fires once per run, next to where your PNGs land.

      The inputs that matter

      There are only two, both straightforward:

      • filename_prefix - the base name for the JSON file (default ComfyUI). The counter and .json extension are appended automatically. Set this to something per-experiment, like batch42_style_test, so runs don't all pile into indistinguishable files.
      • indent - JSON indentation in spaces (default 20). Leave it if you want to read the file by hand; set it to 0 if you're writing a script that consumes it and want a compact dump.

      No outputs, nothing to wire. If you need the saved filename inside the graph, pair it with a Timestamp node in the prefix.

      Installing RF Nodes

      RF Nodes is refreshingly dependency-free - no requirements.txt, no model downloads, pure Python standard library. Install via ComfyUI Manager (search "RF Nodes", repo foxtrot-roger/comfyui-rf-nodes), or manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/foxtrot-roger/comfyui-rf-nodes
      

      Then restart ComfyUI. The node lives under the RF menu category.

      Common issues

      • "Where did my file go?" - It's in ComfyUI/output/, named with your prefix plus a five-digit counter. If you gave it a subfolder via the prefix, look there.
      • "It saved the whole graph, not my prompt text." - That's not a bug, it's the entire point. The JSON contains every node and value in the workflow. If you only wanted the positive prompt, this isn't the node - check the pack's text nodes instead.
      • The README is one paragraph. The pack is described as "work in progress," and the docs are thin. But RF_SavePromptInfo.py is ~30 lines of readable Python; when in doubt, read the source.
      CategoryRF

      Inputs (2)

      NameTypeDefaultDescription
      filename_prefixSTRINGComfyUI
      indentINT20

      Outputs (0)

      No outputs