ai-toolkit-trainer
Train custom LoRAs with ostris AI-Toolkit. Covers WAN 2.2/2.1 (people, styles, video motion) and Z-Image (Turbo & Base, low-VRAM…
SCAIL-2 in-video character replacement on WAN 2.1. WanSCAILToVideo + SCAIL2ColoredMask + SAM3, the reference-image framing→scale rule, and the tuning/compositing pitfalls
Claude Code
$ npx -y skills add artokun/comfyui-mcp --skill wan-scail-replacement --agent claude-code
Codex
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a codex -y
Cursor
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a cursor -y
Gemini CLI
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a gemini-cli -y
GitHub Copilot
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a github-copilot -y
OpenCode
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a opencode -y
Windsurf
$ npx skills add artokun/comfyui-mcp --skill wan-scail-replacement -a windsurf -y
name: wan-scail-replacement description: SCAIL-2 in-video character replacement on WAN 2.1. WanSCAILToVideo + SCAIL2ColoredMask + SAM3, the reference-image framing→scale rule, and the tuning/compositing pitfalls globs: - "**/*.json"
SCAIL-2 (zai-org, on WAN 2.1 14B) replaces the person in a driving video with a character you supply as a reference image, end-to-end, with no pose maps, and with multi-character support. It is the successor to WAN Animate / motion transfer for the "swap the subject, keep the motion" job. The official ComfyUI template is `video_wan21_scail2_character_replacement_int8`, built around `WanSCAILToVideo` (+ `SCAIL2ColoredMask`) with a SAM3 mask driving where the character goes.
This skill documents the non-obvious behaviours that cost a full multi-minute render to discover. It is not a from-scratch graph. Start from the official template and apply the guidance below.
**In `replacement_mode: true`, the reference image's FRAMING controls the output character's SIZE as well as its appearance.** The SAM3 mask controls where the character is placed; the reference image controls how large.
Measured on a 720x1280 driving clip where the subject occupied ~30% of frame height (subject bbox 363 px):
| Reference framing | Person bbox in output | vs driving subject | |---|---|---| | Full-bleed portrait (person ~93% of frame) | 621 px | **1.71x oversized** | | Reframed (person ~34% of frame) | 364 px | **1.003x — correct** |
After reframing, top/bottom registration matched the driving subject within 1 px (the character stands on the same ground plane at the same height). Pose transfer was correct in both cases. Only the scale was wrong, which makes it easy to misread as "the model works" until you A/B against the source.
Guidance: pad or reframe the reference before you render.
> Pad/reframe the reference image onto a canvas at the working resolution so the > person occupies roughly the same fraction of frame height as the subject in the > driving video. A full-bleed portrait reference against a wide-shot driving clip > renders the character oversized in proportion to the framing mismatch.
It is a trap because the template's on-canvas notes do not state it, and it does not show up in the popular Civitai motion-transfer workflows. Those run animation mode, where the reference legitimately fills the frame.
Running the `lightx2v` distill LoRA at `0.8` with `ModelSamplingSD3 shift 5` (the settings the popular Civitai workflow uses) improves colour and detail versus `1.0` / `shift 8`. It also increases adherence to the driving video enough that original-subject details bleed onto the replacement character. In one run the original golfer's neon-yellow shoe appeared on a replacement character who wears white shoes in the reference (same seed, same reference, only those two params changed). If you see source details you didn't ask for, raise the LoRA strength / shift back toward `1.0` / `shift 8`.
The raw SCAIL-2 output shows a measurable colour error (background ~-5 per channel from the VAE round-trip; the character loses red ~2.4x faster than green, which reads as a slight green cast). It is tempting to composite the generated character back over the original plate through the SAM3 mask to "correct" it. Don't. It measures better but looks worse:
severs the grip relationship the model had solved coherently.
SCAIL-2 resolves colour, edges, grip and occlusion jointly; correcting any one of them in isolation breaks the others. Leave the raw output alone.
The template's int8 build was exercised with:
VRAM: ~22.2 GB peak at 576x1024 / 81-frame chunks on a 24 GB card.
<img src="docs/images/demo-poster.jpg" width="760" alt="The Agent panel driving ComfyUI end to end. Click to watch the demo"> The Agent panel driving ComfyUI end to end. It reads what is installed locally, wires the graph, frees VRAM, and runs the render.
Train custom LoRAs with ostris AI-Toolkit. Covers WAN 2.2/2.1 (people, styles, video motion) and Z-Image (Turbo & Base, low-VRAM…
Anime/illustration text-to-image (ANIMA 1.0, ~2B Cosmos DiT). Use for anime, manga, illustrated characters; accepts Danbooru tags…
Train a custom anime LoRA on the ANIMA base model with Citron's local Gradio trainer (kohya sd-scripts), <6GB VRAM,…
Discover Civitai models with the BUILT-IN download_model action:"search_civitai" and install/generate them locally. Find a…
Diagnose and fix video/image color OBJECTIVELY with the get_image (action:"analyze_color") tool (scopes/stats such as black/white…
Core ComfyUI knowledge covering workflow format, node types, pipeline patterns, and MCP tool usage
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…