Nodes/ComfyUI-SCAIL-Auto-Prompt-Builder/SCAIL Auto Prompt Builder V2 (Target + MultiRef JSON)
ComfyUI Node

SCAIL Auto Prompt Builder V2 (Target + MultiRef JSON)

Pick the target, throw in more references, get JSON

By klimentiy23·Created about a month ago·Updated about a month ago· 1
SCAIL Auto Prompt Builder V2 (Target + MultiRef JSON)
  • face_reference_image
  • video_frames
  • body_3_4_reference_image
  • body_front_reference_image
  • body_back_reference_image
  • extra_reference_image
  • prompt
  • diagnostics
  • task_json
  • negative_prompt
  • input_frames
  • planned_output_frames
  • render_plan
task_modecharacter_replacement
target_selectionmain foreground subject
user_hint
model_folderQwen-VL/Qwen3-VL-2B-Instruct
devicecuda
max_side768
max_new_tokens900
temperature0.15
unload_aftertrue
fail_modefallback_template

The plain SCAIL Auto Prompt Builder assumes you're replacing "the main subject" with one reference and writes one prompt. That's fine for a single person in a clean clip. The moment your video has two people, or the character turns and you lose the face, or you want to swap an outfit instead of a person, you're back to hand-editing prose. V2 is the version for those cases: it lets you say who to replace, takes up to five reference images in a defined order, and asks the VLM for structured JSON instead of a single free-form paragraph.

How it works

The reference images are fed in a specific, fixed order - face close-up, body 3/4, body front, body back, optional extra - followed by three sampled video frames. The node tells the VLM what each slot is for: face close-up for facial identity, 3/4 for volume and silhouette, front for proportions and outfit, back for the rear view you'll lose on turns. The model returns strict JSON with task_mode, target_subject, reference_identity, replace, preserve, avoid, a final positive_prompt, a generated negative_prompt, and confidence_notes. The node parses that JSON and spills it out as separate outputs. If the VLM's JSON won't parse, it falls back to a structured template (check diagnostics), and it still auto-calculates the render plan from your frame count - the 4n+1 frame padding SCAIL wants, chunk breakdown at 81 frames with 5-frame overlap, and a note on how to actually preview.

The inputs that earn their keep

  • target_selection - the one you'll actually edit. "woman on the left," "person #2 in red shirt," "foreground dog." This is the whole upgrade over V1.
  • task_mode - character_replacement (default), face_identity_replacement, outfit_replacement, or object_replacement. Background replacement is deliberately not an option.
  • face_reference_image - required. This is the identity anchor.
  • body_3_4_reference_image, body_front_reference_image, body_back_reference_image, extra_reference_image - all optional. In the pack's example workflows, the body-front view is the one routed onward as the main SCAIL reference for the SAM mask and CLIPVision path.
  • device - note the default here is cuda, not cpu like V1. Keep unload_after=True so the VLM frees VRAM before video generation.

Seven outputs: prompt and negative_prompt (STRINGs for your positive and negative CLIPTextEncode), task_json (the full structured plan, handy to eyeball or log), input_frames and planned_output_frames (INTs), render_plan (a STRING describing the chunking), and diagnostics.

The multi-reference trap

The README is refreshingly honest about this: extra references are not a guaranteed improvement. SCAIL can accept a batch of reference images, but "large/unclear stacks can hurt placement/quality." A single clean body/front reference is the recommended default; add the face and back views only when the clip actually needs them - turns, rear views, identity drift. That aligns with the wider lesson in the KB: identity consistency across a moving character is exactly where every method wobbles, and SCAIL-2's own weak spot is face consistency and cross-chunk drift on longer clips (see the SCAIL-2 panel in the KB). V2 writes a better brief for the model; it doesn't cancel the model's limits.

Install and gotchas

Same pack, same install as the rest of this family - ComfyUI Manager search "SCAIL Auto Prompt Builder," or clone https://github.com/klimentiy23/scail-auto-prompt-builder into ComfyUI/custom_nodes and restart. It needs a local Qwen3-VL-2B-Instruct (or similar) under <models>/LLM, set via COMFYUI_MODELS_DIR on non-Windows machines. No downloads, no API. The node only writes text - the actual long-video chunking is done by the companion SCAIL Auto Extend node, so don't expect planned_output_frames to be rendered by this node alone. If the JSON output ever looks off, that's the 2B VLM misreading a busy frame; raise temperature a notch or sharpen target_selection, and always preview before a full render.

CategorySCAIL/Prompt

Inputs (16)

NameTypeDefaultDescription
face_reference_imageIMAGE
video_framesIMAGE
task_modeCOMBOcharacter_replacement4 options: character_replacement, face_identity_replacement, outfit_replacement, object_replacement
target_selectionSTRINGmain foreground subject
user_hintSTRING
model_folderCOMBOQwen-VL/Qwen3-VL-2B-Instruct1 options: Qwen-VL/Qwen3-VL-2B-Instruct
deviceCOMBOcuda2 options: cpu, cuda
max_sideINT768256–1536
max_new_tokensINT900128–2000
temperatureFLOAT0.150–1.2
unload_afterBOOLEANtrue
fail_modeCOMBOfallback_template2 options: fallback_template, raise_error
body_3_4_reference_imageoptIMAGE
body_front_reference_imageoptIMAGE
body_back_reference_imageoptIMAGE
extra_reference_imageoptIMAGE

Outputs (7)

NameTypeDescription
promptSTRING
diagnosticsSTRING
task_jsonSTRING
negative_promptSTRING
input_framesINT
planned_output_framesINT
render_planSTRING