Nodes/ComfyUI-PromptRelay/Prompt Relay Encode (Smart)
ComfyUI Node

Prompt Relay Encode (Smart)

Write `[0-50]` instead of counting frames by hand

By kijai·Created 4 months ago·Updated 3 months ago· 473
Prompt Relay Encode (Smart)
  • model
  • clip
  • latent
  • model
  • positive
global_prompt
smart_prompt
normalize_by_tokensfalse
epsilon0.0010

Plain Prompt Relay Encode makes you split your local prompts and hand-count segment_lengths yourself. Smart Encode skips that entirely: you write one smart_prompt field using a lightweight syntax, and the node figures out how to divide the video's frames across your segments for you. It's the version most people should actually reach for first - a Reddit user's writeup of a zombie-chase test used exactly this pattern, splitting a "global prompt" (character, lighting, environment) from pipe-separated "local prompts" describing each action beat, and the result held scene continuity through a chaotic scene that would normally have the model losing the plot halfway through.

The two syntaxes (pick one, don't mix them)

Inline, pipe-separated, same as plain Encode but with optional weights: A man walks through a forest [0-50] | He stops and looks around [50-150] | He runs back [150-200]. Those bracketed numbers aren't frame counts - they're relative positions on whatever scale you pick. Total span here is 200, so segment one gets 25% of the video, segment two gets 50%, segment three gets 25%, no matter how many actual frames the clip has. Leave the brackets off entirely and every segment just gets equal time.

Block, newline headers: a line like Scene 1: or Part 4: or literally any word plus a number and a colon, followed by the segment text on the next line. The header line gets stripped before it ever reaches the tokenizer. A bare ordinal number (Scene 1:) means equal weight; a range (Scene 1-2:, Scene 2-5:) works the same way the inline brackets do - the span of the range becomes the proportional weight. The README is explicit that you should not mix the two styles in one prompt, so pick one and stay in it.

Inputs and outputs that matter

  • model, clip, latent - same as the other Encode nodes; frame count comes from the latent's shape.
  • global_prompt - same anchoring role, but here you can leave it blank and the node auto-uses your first parsed segment as the anchor. The README's recommended pattern: put your establishing shot in segment 1, leave global_prompt empty, and use the rest of your segments purely for action changes.
  • smart_prompt - the single field with your syntax in it, inline or block.
  • normalize_by_tokens (default off) - when on, each segment's weight gets multiplied by its actual CLIP token count before frames are distributed, so a wordier segment gets proportionally more screen time rather than every segment being treated as equally "big" regardless of length.
  • epsilon - same boundary-sharpness role as plain Encode (0.001 default for sharp cuts, 0.5+ for soft blends).

Outputs are the patched model and positive conditioning, same wiring as every other node in this pack.

Installing it

Search "ComfyUI-PromptRelay" in ComfyUI Manager, or git clone https://github.com/kijai/ComfyUI-PromptRelay into custom_nodes and restart. One optional extra for this node specifically: if you want to write header numbers as words instead of digits ("Scene eleven:" instead of "Scene 11:"), install word2number (pip install word2number). Skip it and you just stick to digits - nothing else breaks.

Common issues

Mixing inline and block syntax in the same prompt. The README calls this out directly - pick one style per smart_prompt and don't blend them, or the parser won't do what you expect.

"This all seems so complicated." That's a genuine, common first reaction from people trying this pack - it showed up more than once in the same Reddit thread that showcased it working well. The syntax itself is small; the learning curve is mostly about getting a feel for how bracket/range weights translate into actual screen time. Start with two segments and equal weighting before you reach for ranges.

If you're specifically on LTX and see stray text baked into the very end of your clip, that's been traced to an LTX spatial upscaler bug, not this node - updating to the 1.1 spatial upscaler fixed it for at least one person hitting it. Worth ruling out before you assume Prompt Relay did it.

Writing prompts with an LLM. The README ships copy-paste instruction templates for both syntaxes to hand to a VLM/LLM - genuinely useful if you're generating segment text from a source image or video rather than typing it yourself.

Categoryconditioning/prompt_relay

Inputs (7)

NameTypeDefaultDescription
modelMODEL
clipCLIP
latentLATENT
global_promptSTRINGConditions entire video. Leave empty to auto-use the first parsed segment from smart_prompt as the global anchor.
smart_promptSTRINGEnter prompt using Smart Syntax:\n1. Inline: 'text one [0-50] | text two [50-100]'\n2. Block: 'Second 1:\ntext one\nSecond 2:\ntext two'\nSyntax is auto-stripped and normalized evenly or proportionally.
normalize_by_tokensBOOLEANfalseIf true, scales the calculated length of each segment by its token count.
epsilonFLOAT0.00100.000001–0.99

Outputs (2)

NameTypeDescription
modelMODEL
positiveCONDITIONING