Nodes/ComfyUI-Easy-Media/!!Remove h3 motion context latent
ComfyUI Node

!!Remove h3 motion context latent

The cleanup node that stops your H3 loops from filling the disk

By yolain·Created 3 months ago·Updated about 17 hours ago· 158
!!Remove h3 motion context latent
  • input
  • output
  • deleted_count
filename_pathh3_context/clip

Long-form MiniMax H3 workflows have a dirty secret: "Motion Context" - the saved latent state that lets one generated clip continue into the next - is written to disk as files, and if you loop a workflow a hundred times without cleaning up, those files pile up fast. Remove h3 motion context latent is the node that sweeps them after a loop finishes. It's a housekeeping tool, and it knows it: the !! in the display name is the pack flagging it as a cleanup node you should understand before you use.

What it does

It deletes latent files that start with a prefix you give it, relative to ComfyUI's output directory. That's the whole mechanism. filename_path defaults to h3_context/clip, which deletes everything beginning with clip inside output/h3_context - i.e., the motion-context latents an H3 loop wrote there. The slashes select subdirectories, so h3_context/clip is "the clip-prefixed files in output/h3_context."

Two inputs, no guesswork:

  • filename_path - the file prefix to remove. Default h3_context/clip is right for standard H3 loops.
  • input - a pass-through of any type. This is how you chain it: the node sits in the middle of the loop, forwards input untouched on its output, and runs the deletion when it executes.

The deleted_count INT output tells you how many files were actually removed - a zero means either nothing was written or the prefix is wrong.

How to wire it

The intended placement is inside or just after the loop that produces the latents: whatever your loop's final output is feeds this node's input, the unchanged value comes out the output side to keep the graph flowing, and the deletion happens in the same pass. Since it's marked as an output node, ComfyUI knows to treat it as a terminal step and actually execute it.

Because it's destructive, respect the guardrails. The prefix is a prefix match, not a single-file match - clip will nuke every file starting with clip in that folder. If you've hand-saved latents with names that collide with the pattern, point filename_path somewhere specific rather than broad, and double-check deleted_count after the first run to confirm you're only removing what you meant to.

Install

It ships in ComfyUI-Easy-Media:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Media.git

restart ComfyUI (or ComfyUI Manager, "Easy-Media"), and FFmpeg system-wide per the pack's README. It doesn't need any of the heavy H3 model files itself - it's pure file management - but it only makes sense inside a workflow that's actually writing H3 motion-context latents, so expect it alongside the pack's MiniMax H3 generation nodes. If your disk is quietly filling with output/h3_context/*, this is the node you've been missing.

CategoryEasyUse/MiniMax

Inputs (2)

NameTypeDefaultDescription
filename_pathSTRINGh3_context/clipFile prefix relative to the output directory. Slashes select subdirectories; h3_context/clip removes files beginning with clip inside output/h3_context.
input*

Outputs (2)

NameTypeDescription
output*
deleted_countINT