MiniMax H3 Contex Loop End
Finish a shot, hand off, run the next
- flow
- state
- images
- sampled_latent
- segment
- manifest
- manifest_json
- last_context_frames
- last_context_latent
MiniMax H3 Contex Loop End is where the "loop" in "Contex Loop" physically happens. The sampling body between Loop Start and this node renders one scene; Loop End checks whether the scene is the last one, and if it isn't, it recursively executes the whole body again for the next scene. It's the reason a five-scene movie is one queue and one graph instead of five cut-and-pasted workflows.
Mechanically it's the counterpart to Loop Start's flow output. That flow link defines the recursive body - the thing that gets cloned for every later scene - and Loop End consumes it. The tooltip on flow is the single most important warning in the pack: connect it directly from Loop Start, don't route it through anything. This node clones that body, so any node sitting in the path silently breaks the recursion.
The inputs
flow- the raw recursion link from Loop Start. See above.state- current state from Current Shot. Loop End appends the accepted segment and advances the scene index.images- the delivered current-scene images after Motion Context Trim. Their tail becomes the next scene's visual context. That's why trimming happens before this node - you don't want the repeated overlap frames carried as context.sampled_latent- the current sampler output. Its AV streams become the next scene's generated-audio context when the selected audio mode requires it.segment- the approved persisted segment, from Review Gate or directly from Segment Save when you're running without review.between_scene_cleanup(optional) - a runtime memory policy applied after a scene is safely checkpointed and before the next starts.offkeeps ComfyUI caches;unload_modelsreleases weights from VRAM;fresh_scenegoes further - requesting RAM-pressure-cache eviction, garbage collection, unpinning model pages, unloading models and emptying the CUDA allocator. It's best for model-switching chains, and the tooltip is honest that ComfyUI has no safe full executor reset inside a running recursive prompt, so a small live-loop carry always remains.
The outputs
manifest- the completed chain manifest, produced only when the final scene is accepted. This is what you feed to H3 Chain Assemble.manifest_json- the human-readable JSON form, for inspection or backup.last_context_frames/last_context_latent- the final scene's tail frames and sampled AV latent, for chaining this production into another workflow if you want.
The honest read
Loop End is one of those nodes you almost never touch after wiring - the maintained workflows set between_scene_cleanup to off and that's it. But understanding it explains half the pack's design: continuity lives in the loop, not in the workflow. Each scene's accepted predecessor supplies context to the next, and completed media stays on disk, so the loop is resumable and reviewable one scene at a time.
Installing it
Part of ComfyUI-MiniMaxH3-Contex-Loop (ComfyUI Manager: "MiniMax H3 Contex Loop"), or:
cd ComfyUI/custom_nodes && git clone https://github.com/ethanfel/ComfyUI-MiniMaxH3-Contex-Loop.git
Restart ComfyUI. H3 weights and a current ComfyUI with native Add Guide (PR #15439) are the standing requirements; ffmpeg on PATH helps the review/assembly steps that surround it.
Common issues
The one failure mode that matters is the flow connection - if scenes stop progressing or the loop doesn't advance past scene 1, that raw link is the first thing to recheck. Also worth knowing: the manifest output is only produced on the final accepted scene, so don't expect a usable manifest mid-loop. If you stop early and approve-and-stop, assemble the partial manifest via Manifest Load instead.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| flow | H3_CHAIN_FLOW | Connect DIRECTLY from Loop Start's flow output. This raw link defines the recursive body that Loop End clones for later scenes. | |
| state | H3_CHAIN_STATE | Current state from Current Shot. Loop End adds the accepted segment and advances its scene index. | |
| images | IMAGE | Delivered current-scene images after Motion Context Trim. Their tail becomes the next scene's visual context. | |
| sampled_latent | LATENT | Current sampler output. Its AV streams become the next scene's generated-audio context when the selected audio mode requires it. | |
| segment | H3_CHAIN_SEGMENT | Approved persisted segment from Review Gate, or directly from Segment Save when no review is wanted. | |
| between_scene_cleanupopt | COMBO | off | Runtime-only memory policy applied after a scene is safely checkpointed and before the next scene or retry starts. off keeps ComfyUI caches; unload_models releases loaded weights from VRAM; fresh_scene first requests active RAM-pressure-cache eviction and Python garbage collection, then releases remaining pinned model pages, unloads models, and empties the CUDA allocator. fresh_scene may reload model/reference nodes and is best for model-switching chains. ComfyUI has no safe full executor reset inside a running recursive prompt, so the small live loop carry remains. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| manifest | H3_CHAIN_MANIFEST | Completed chain manifest for H3 Chain Assemble. Produced only when the final scene is accepted. |
| manifest_json | STRING | Human-readable JSON form of the completed manifest. |
| last_context_frames | IMAGE | Delivered tail frames from the final scene for optional chaining into another workflow. |
| last_context_latent | LATENT | Final sampled H3 AV latent for optional continuation outside this loop. |