Nodes/ComfyUI-RMAutomation/RM Save Lineage (multi-stage)
ComfyUI Node

RM Save Lineage (multi-stage)

Save a whole multi-stage run from one node, family tree included

By Moser9815·Created 7 months ago·Updated 22 days ago· 0
RM Save Lineage (multi-stage)
  • styles_pipe
  • image_1
  • saved_paths
destination
plot
step_names

You do multi-stage work. Base image, refine, upscale 4x - three or four passes, each building on the last. Normally that's a save node per stage, and tracking which file came from which is your problem. This node collapses the whole thing into one: wire each stage's image into a slot, and it saves every stage with the parent-child links already recorded in the file metadata. The name isn't hype - the lineage is the point.

How it works

The inputs image_1, image_2, image_3, … are ordered by slot number, and that order is the chain: the last connected slot is the final output, everything before it is an intermediate, and each stage's parent is the slot before it. The frontend keeps a trailing empty slot open, so extending the chain is just wiring one more image and the next slot is already waiting.

On save, each PNG gets the standard ComfyUI prompt/workflow metadata plus a set of rm_* text chunks - rm_run_id (groups all siblings from one run), rm_parent (JSON array of parent refs; empty means root, multiple means a merge), rm_step, rm_step_name, rm_role (intermediate vs final), rm_variant. Step numbers are sparse (0, 10, 20…) so you can insert a stage between two existing ones later without renumbering anything already on disk. The parent-matching logic is smart about batches, too: it matches positionally when batch sizes are stable, merges all parents when a stage collapses to one image, and fans one parent out to many. A run is a tree, not a list.

The inputs that matter

  • styles_pipe (required) - an RM_STYLES_PIPE from the pack's styles nodes. This is how the node knows what to call things: the positive/negative/motion prompts go into the metadata, and the style's prompt number becomes the folder (Images/<number>/).
  • destination - Sketchbook or Playground. These are hardcoded Windows paths (C:\Users\rober\...) in the source - see the caveat below.
  • plot - yes/no/both. yes writes only a contact sheet of the final to the Contact Sheets folder; no writes only the individual images; both does both.
  • step_names - one name per line, matching image_1, image_2, … These become the rm_step_name labels ("Base", "Refine", "Upscale 4x") that show up in the lineage panel instead of "Step 3".

Output is saved_paths (STRING) - a JSON array of the refs it wrote, which you can feed into another save node's parent_path to keep a chain going across runs.

The trade-off, stated honestly

The author says it outright in the code: ComfyUI only runs a node once all of its inputs resolve, so nothing reaches disk until the whole run finishes. Crash at stage 4 and you've lost stages 1–3, and all N full-resolution images are held in memory at once. For a short linear pipeline that's a non-issue. For a long or expensive run, use the per-stage RMSaveImageWithMetadata nodes instead - they write as they go.

The bigger caveat: it's built for one person's machine

The Sketchbook and Playground destinations point at C:\Users\rober\OneDrive\Documents\Sketchbook and C:\Users\rober\Playground, baked into the source with no override. This pack is the author's personal automation suite, published. If you're not "rober" on Windows with that exact OneDrive structure, the node will create literal C: directories relative to wherever ComfyUI runs and the lineage refs won't resolve to anything the viewer indexes. Treat the lineage/Playground half of this pack as a pattern to steal rather than a drop-in - the pattern being: write your run's history into the PNG text chunks and let the chain survive re-encoding only if you keep the originals.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/Moser9815/ComfyUI-RMAutomation

Restart ComfyUI, or install via ComfyUI Manager by searching RMAutomation. No model downloads. The node itself only needs PIL and torch, both already in ComfyUI; the pack's heavier requirements (opencv-python, ultralytics) are lazy-imported by unrelated nodes.

For a linear pipeline where "save it all, remember the order" is the goal, this is genuinely elegant - one node instead of four save nodes and a spreadsheet. Just don't run it on a machine that doesn't match the author's folder layout and expect the lineage to mean anything.

CategoryRMAutomation/Image

Inputs (5)

NameTypeDefaultDescription
styles_pipeRM_STYLES_PIPE
destinationCOMBO2 options: Sketchbook, Playground
plotCOMBO3 options: yes, no, both
image_1optIMAGE
step_namesoptSTRING

Outputs (1)

NameTypeDescription
saved_pathsSTRING