Nodes/Trent Nodes/Save for Next Time
ComfyUI Node

Save for Next Time

Pass data between queue runs without touching disk

By TrentHunter82·Created 11 months ago·Updated a day ago· 50
Save for Next Time
  • image
  • mask
  • audio
  • video
  • latent
    ◄slot_namedefault►
    ◄max_entries10►
    ◄text—►
    ◄note►

    ComfyUI has a genuinely awkward gap: it's great at one run, but there's no built-in way to say "take what I just made, and start the next run from it." You end up saving a frame, remembering the filename, then hand-loading it into the next workflow. Save for Next Time closes that gap - it stashes whatever data you wire into it under a named slot, and its sibling Take from Last Time reads it back on a later queue run.

    The use case is the "iterate on my last render" loop: save the last frame, the prompt that made it, and maybe the latent, then have the next run pick all of them up without you touching a single load node.

    How it works

    You pick a slot_name (the folder under output/for_next_time/<slot_name>/), connect any mix of inputs, and everything that arrives together becomes one entry. Connect as many or as few as you like - a single entry holds whatever was wired that run:

    • image → saved as PNG (one file per batch frame)
    • mask → grayscale PNG
    • text → UTF-8 text
    • audio → FLAC
    • video → MP4 (copied without re-encoding when the source already matches)
    • latent → a .latent safetensors file
    • note → a label stored in the entry's meta.json, purely for your own bookkeeping

    max_entries keeps the newest N saves (default 10) and deletes the rest. Keep it low - the tooltip warns that each entry holds a full copy of the video, so a big max_entries fills your disk in a hurry.

    Two details show real care. Entries are published by an atomic folder rename, so a run killed mid-save never leaves a half-written entry. And if you rename an entry folder by hand to drop the 00000001- timestamp prefix, it becomes a permanent pin - still reachable by name, never pruned.

    The design quirk that will surprise you

    This node has no outputs, on purpose. The reason is a subtle ComfyUI cache interaction: the node has to run every queue (it's NOT_IDEMPOTENT), and a node that runs every time poisons the cache of everything downstream of it. Give it outputs and NaN-style always-run behavior, and you'd force the sampler and everything else to re-run every queue. So instead, you wire your data to this node and to whatever else needs it - it's a tap, not a sink.

    Wiring and caveats

    The pair is designed for consecutive runs. Using Save and Take on the same slot in the same prompt isn't supported - ComfyUI doesn't order two unconnected nodes, so Take's cache check can run before Save does. If that trips you up, split it into two runs.

    Where people get burned: forgetting the slot_name has to match exactly between Save and Take (letters, digits, spaces, and . - _ only), and forgetting that max_entries applies to the slot, so an old pinned name you thought you deleted is still sitting there. Both are one-look fixes.

    Install

    It's one of ~69 nodes in TrentNodes:

    # ComfyUI Manager: search "Trent Nodes"
    
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/TrentHunter82/TrentNodes.git
    cd TrentNodes && pip install -r requirements.txt
    

    No extra dependencies for this pair. It's the kind of node that reads as "why would I need that" until the first time you finish a render, queue the next run, and watch your last frame just appear where it belongs.

    CategoryTrent/Utilities

    Inputs (9)

    NameTypeDefaultDescription
    slot_nameSTRINGdefaultFolder name under output/for_next_time/. Use the same name on Take from Last Time. Letters, digits, spaces, . - _ only
    max_entriesINT101–1000How many saves to keep. Older ones are deleted. Keep this low for video - each entry holds a full copy of the file
    imageoptIMAGESaved as PNG (one file per batch frame)
    maskoptMASKSaved as a grayscale PNG
    textoptSTRINGSaved as UTF-8 text
    audiooptAUDIOSaved as FLAC. Lossless for real audio, but not bit-exact for float32 waveforms
    videooptVIDEOSaved as MP4. Copied without re-encoding when the source already matches
    latentoptLATENTSaved as a .latent safetensors file, with its noise mask. MiniMax H3 AV latents keep both the video and audio streams
    noteoptSTRINGOptional label stored in the entry's meta.json. Does not affect the filename

    Outputs (0)

    No outputs