Nodes/H3 Motion Context/H3 Chain Prompt (experimental)
ComfyUI Node

H3 Chain Prompt (experimental)

The node that remembers what each clip was asked for

By NikoDemon80·Created 4 months ago·Updated 5 days ago· 1,466
H3 Chain Prompt (experimental)
    • prompt
    • clip_index
    ◄chain_folderh3_context►
    ◄clip_index1►

    Almost every node in this pack does something you can see. This one hands one string to another node, and it exists because upscaling a MiniMax H3 chain has an awkward requirement: the refine pass re-reads each clip's own prompt, so clip 3 has to be refined with clip 3's prompt - not clip 1's, not whatever is sitting in the text box when you hit run.

    You could babysit that. Paste prompt 3, run, paste prompt 4, run. The reason the author didn't leave it there is that Chain Upscale's panel runs clips out of order: it skips finished ones, redoes stale ones, picks up a stopped run partway. Keeping a text box in sync with that by hand is exactly the kind of thing you get wrong at clip 11 of 12.

    How it knows the prompt

    The prompt isn't magically recovered from the video. When you make the low-res chain, you wire the prompt text into Save Latent's prompt input, and Save Latent writes it into that clip's latent file next to the frames. H3 Chain Prompt then reads the file for the clip it's pointed at and hands the text back out. If a clip was saved without a prompt, the file simply has nothing to give - more on that below.

    Both of its widgets are panel-controlled, which is the whole trick: before each run, Chain Upscale sets chain_folder and clip_index on every H3 Chain Prompt in the workflow, including the ones in subgraphs. So the node never falls out of step with the clip being refined, because something else moves it on every queue.

    The two settings, and why you leave them alone

    chain_folder defaults to h3_context, which is the folder Save Latent writes chains into. clip_index defaults to 1 and counts from 1 the way a person counts - clip 1 is the first clip. Both carry the same tooltip: set by the panel, no need to change it. Believe it. The only time you'd touch clip_index by hand is a one-off render of a single clip outside the panel.

    What you wire

    The prompt output goes into your text encoder, then into Reference to Video, then into Chain Upscale's conditioning. That's the documented path and it's the one that matters; the refine needs conditioning that matches what the low-res pass used.

    The clip_index output is the escape hatch. It's the clip being upscaled, as an integer, so if you have a chain saved without prompts - an older chain, or one built by another tool - you drive your own list of prompts off that index and leave prompt unwired. A prompt-list node indexed by clip_index gives you per-clip prompts without any file bookkeeping.

    Where it bites: if the prompt output is wired and a clip recorded no prompt, the node refuses and names the clip and the file it looked at, rather than refining a clip with an empty prompt. That's deliberate and it's the right call - a silent empty prompt in a refine gives you a clip that quietly doesn't match its neighbours, and you'd only find out after the movie.

    Install

    ComfyUI Manager, search H3 Motion Context (the pack's display name; publisher nikodemon80), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/NikoDemon80/ComfyUI-H3-Motion-Context
    

    Then restart ComfyUI. You need ComfyUI 0.34.0 or newer - that's the release where H3 gained arbitrary keyframe anchors, and the pack's core nodes depend on it. On 0.33.4 or older you want pack version 0.3.1, which still runs on both.

    There's no requirements.txt, and you won't need one: the pack imports numpy, PIL and aiohttp, all of which ComfyUI already ships, and pulls in PyAV lazily only when it writes a video file. If you previously had the separate ComfyUI-H3-Disk-Upscale pack installed, remove it - this one replaces it.

    At startup you'll see:

    h3_motion_context: nodes registered. ComfyUI is not modified; the layout
    checks run on the first use of a Motion Context node.
    

    That's all you get, and all you should get.

    Troubleshooting

    It outputs an empty string. The clip has no recorded prompt. That's expected on chains made before you wired Save Latent's prompt input, and on chains from other tools. Untick or unwire prompt and use clip_index with your own prompt list.

    It refuses with a clip number in the error. Same cause, but you've left prompt wired. The error names the clip and the file - that's a fair warning, not a bug.

    Nothing changes when you re-run. It re-reads on each queue: the node stamps itself with the prompt file's path and modification time, so saving a new prompt for the same clip does get picked up. What it can't do is invent a prompt that was never recorded.

    You're using it without H3 Chain Upscale. Then it's just a string reader that needs its two widgets set by hand, and you're paying panel-shaped overhead for a text box. Skip it.

    This is a niche node, honestly - plumbing you set up once and then forget, in service of a workflow (a finished low-res chain going up in resolution) that you can't do properly without it. That's a fine thing for a node to be.

    Categorylatent/minimax

    Inputs (2)

    NameTypeDefaultDescription
    chain_folderSTRINGh3_contextSet by the Chain Upscale panel. No need to change it.
    clip_indexINT11–9999Set by the Chain Upscale panel. No need to change it.

    Outputs (2)

    NameTypeDescription
    promptSTRINGThis clip's prompt, as Save Latent recorded it. Into your text encoder, then Reference to Video, then Chain Upscale.
    clip_indexINTThe clip being upscaled. For chains saved without prompts, use it to pick your own.