Nodes/barakapa-nodes/Save Workflow (Custom)
ComfyUI Node

Save Workflow (Custom)

Stop saving the same workflow 12 times — this one dedupes for you

By barakapa·Created about a year ago·Updated about a year ago· 0
Save Workflow (Custom)
  • ignored_inputs_0
  • ignored_inputs_1
  • ignored_inputs_2
  • workflow_id
  • workflow_id_str
directory_name
file_name_prefixworkflow_
is_counter_enabledtrue
file_name_suffix

The flagship, and it's a weirdly smart one

The pack's own description leads with "compare and save unique workflows," and this is that node. On the surface it's a workflow-saver: give it a folder, it writes the current graph out as JSON. The twist is the dedupe. Before writing, it compares your current workflow against every .json already in that folder. If an identical graph has been saved before, it does nothing - it tells you the file already exists and hands back the existing one's number. If it's genuinely new, it writes it and hands back the new number.

If you've ever opened your workflow archive and found workflow_9.json, workflow_10.json, and workflow_11.json that are all the same graph with slightly different node positions, you know exactly why this exists.

How the dedupe works

This is the interesting part, and the source is worth reading because the comparison is smarter than "are the files equal":

  • It strips metadata - node positions, titles, _meta - everything that doesn't affect execution.
  • It canonicalizes the graph: nodes get sorted, node IDs get remapped so the same graph built in a different order compares equal, and floats get normalized so 0.3 on one side matches 0.3 on the other.
  • Then it compares. Same functional graph, different layout? Duplicate. Same graph with the seed changed? Not a duplicate - unless you tell it otherwise.

That last bit is what the ignored_inputs_0, ignored_inputs_1, and ignored_inputs_2 inputs are for. Connect any node to one of those sockets and its input values get excluded from the comparison. Wire your random seed node in there and suddenly two workflows that differ only in seed count as the same workflow - which, for archiving purposes, they are.

A small JS extension that ships with the pack adds a read-only text box to the node showing the last message ("Workflow exported to …" or "Workflow already exists at …"), so you get feedback right on the canvas instead of hunting the console.

Inputs and outputs

Inputs: directory_name (subfolder of output), file_name_prefix (default workflow_), is_counter_enabled (default true - the number in the filename), file_name_suffix, plus the three ignored_inputs sockets. It's an output node, and it also returns workflow_id (INT) and workflow_id_str (STRING) - the counter of the saved-or-existing workflow - which you can use downstream if you want the ID in a log or filename. On a duplicate match the ID is parsed back out of the existing file's name; if it can't be, you get -1.

Gotchas

The comparison is content-based, so two layouts of the same graph collapse into one file - that's the feature, not a bug, but it means "save a copy so I can try a radical rearrangement" won't produce a second file unless the graph actually changed. That's what the counter is for if you want versioning: turn off dedupe-by-ignoring, or just add a suffix. Also note it saves a JSON workflow, not a PNG - for the shareable image-with-embedded-workflow, that's brkp_SaveImage's job. And like the pack's other counter nodes it always re-runs, so expect it to fire every execution.

Installing it

Part of barakapa-nodes. ComfyUI Manager → search barakapa → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/barakapa/barakapa-nodes

Then restart ComfyUI. No models, no dependencies beyond ComfyUI itself.

Verdict

It's the one node in this pack that isn't a convenience - it's a small piece of actual engineering. If you archive workflows at all, the dedupe alone justifies the install. Give it a folder, ignore the seed, and let it keep your archive honest.

Categorycustom/Save

Inputs (7)

NameTypeDefaultDescription
directory_nameSTRINGSub-directory of the output directory to save workflows to.
file_name_prefixSTRINGworkflow_Prefix to be added before the file name.
is_counter_enabledCOMBOtrueIf enabled, counts the number of images in the specified sub-directory and uses it in the file name. Otherwise, the file name will just consist of the prefix and the suffix.
file_name_suffixSTRINGSuffix to be added after the file name.
ignored_inputs_0opt*Connect any workflow node here to ignore changes in that node's inputs.
ignored_inputs_1opt*Connect any workflow node here to ignore changes in that node's inputs.
ignored_inputs_2opt*Connect any workflow node here to ignore changes in that node's inputs.

Outputs (2)

NameTypeDescription
workflow_idINT
workflow_id_strSTRING