Note
AI-Assisted Development: These custom nodes, UI extensions, scripts, and documentation were created with AI assistance. In the spirit of complete transparency: if you prefer not to use AI-assisted code, please feel free to pass on this custom node suite.
This project is AI Assisted, by AI for AI
A comprehensive collection of professional-grade custom nodes for ComfyUI, featuring AI-powered prompt refinement, advanced model loading, multi-section detailing, tiled upscaling, and sophisticated batch processing workflows.
ComfyUI-ModusFlow provides 22 custom nodes organized into six categories:
๐ค AI & Prompt Enhancement
- Ollama Prompt Refiner - Full-pipeline prompt enhancement with Ollama LLMs, conditioning output, and pipe support
- Ollama Text Refiner - Lightweight text refinement via Ollama
- Image For Prompting - Metadata extraction and AI-powered image descriptions
๐ฆ Model & Resource Loading
- Model Loader - UNet/checkpoint, multi-CLIP (DualCLIP + up to 4 individual), and VAE loader
- LoRA Loader - Stack-based LoRA management with validation and Civitai integration
- Multi-CLIP Text Encode - Per-CLIP text inputs with Flux guidance and single conditioning output
๐จ Sampling & Generation
- KSampler - Enhanced sampler with pipe support, audio latent handling, and CUDNN control
- Batch KSampler - Simplified KSampler for batch workflows
- Latent Preset - Blank latent generator with common resolution presets
- Modus Dynamic Guidance - Sampling-level dynamic guidance hook to address plastic, waxy skin tones without LoRAs
๐ผ๏ธ Image Enhancement & Post-Processing
- Detailer Slot - Config bundle for one YOLO detection + inpaint pass
- All-in-One Detailer - Runs any number of Detailer Slots sequentially with pipe support
- Model Upscale - All-in-one neural upscaler (e.g. 4x-UltraSharp) with optional downscale and pre-downscale upscale saving
- Upscaler - Tiled upscaling with seam fixing and post-processing
- Restormer - Deep learning image restoration (motion deblur, defocus, denoising)
- Modus De-Wax Texture Restore - Post-decode micro-texture reconstruction and organic sensor grain restoration
๐ Audio & Video
- Save Audio - Multi-format audio export (flac, wav, mp3, ogg) with filename variables
- ACE Step Audio 1.5 - TextEncodeAceStepAudio1.5 with song save/load for tags and lyrics into unified library
- Song Writer & Lyric Studio - Interactive AI lyric studio (Ollama local/cloud, OpenAI-compatible cloud LLMs, DuckDuckGo web research grounding), structured lyric templates, musical styles, and unified save/load library
- Audio Mixer & Video Sync - Blends sound effects (MMAudio) with background music tracks for video muxing
- Video Latent Preset - Wan 2.1 & Wan 2.2 spatio-temporal video latent generator with native I2V/T2V, plus
durationandfpsoutputs for automated MMAudio synchronization - Save Video - Multi-format video export (H.264, HEVC, VP9) with AAC audio muxing and interactive preview
โ๏ธ Conditioning & Guidance
- ControlNet All-in-One - Complete all-in-one ControlNet pipeline (model loading, preprocessors, stick figure routing, and pipe scheduling)
- ControlNet Loader & Apply - Direct ControlNet model loader and pipe-aware conditioning application
- Image Preprocessor - Zero-dependency preprocessor (Canny, LineArt, Color, Tile, Luminance Proxy)
- Conditioning Concat - Encode text and concatenate onto existing conditioning
๐ ๏ธ Utilities & Prompting
- Master Seed - Centralized master seed generator and synchronizer (randomize, fixed, increment, decrement)
- Smart Resizer - Aspect ratio optimization and smart cropping/padding for diffusion models
- Show Text - Simple text display for prompts, LoRA logs, and debugging
- Text Editor - Interactive text editor with live syntax highlighting, intelligent autocomplete (lists, $vars, %sys%, ), tag weight stepping (Ctrl+Up/Down), negative presets, direct CLIP conditioning, pipe passthrough, and category-filtered save/load
- List Curator - Curated trait pool selector with on-canvas editor, live syntax highlighting, item counter, and autocomplete
- Ollama Prompt Refiner - Prompt enhancement with category-filtered save/load to unified prompts library
- Image Gallery - Browse output directory with metadata viewing
- Save Image - Save images in PNG/JPEG/WebP with filename variables and metadata embedding
The ModusFlow Text Editor turns ComfyUI prompt crafting into a full-featured IDE. Designed for creators who build complex, dynamic, and multi-character workflows, it replaces plain text boxes with live syntax highlighting, programming-grade dynamic templating, seamless prompt-driven LoRA loading, and an expansive Pop-Out Studio.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ModusFlow Text Editor & Prompt Studio โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Live Syntax Highlighting & Dark Themes โ
โ โข Modular File Imports: @import "lib/file" โ
โ โข Reusable Macro Functions: @func($arg) โ
โ โข Dynamic CASE & Switch Branching โ
โ โข Compound Boolean Ternaries (&&, ||, !) โ
โ โข Percentage Chance Modifiers: {40%: tags} โ
โ โข Inline Arithmetic: {$weight + 0.2} โ
โ โข Null-Coalescing Operator: $var ?? fallback โ
โ โข Filter Pipes: $tag | plural | upper โ
โ โข Arrays, Lists & Dicts: $obj.prop, $arr[0] โ
โ โข Loops & Repetition: repeat(3), for $c in L โ
โ โข Seamless Dynamic LoRA Prompt Tagging โ
โ โข Tag Weight Stepping (Ctrl+Up/Down) โ
โ โข Cross-Model Linguistic Weight Translation โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
[Direct CLIP Conditioning] [Clean Prompt String]
โข Encoded with active CLIP โข Stripped of raw tags
โข Injected with LoRA metadata โข Ready for preview & metadata
โข Seamless LoRA Loader link โข Clean generation prompt
| Feature | Description |
|---|---|
| ๐ Modular File Imports | Import and compose external prompt files with @import "styles/cyberpunk" or @import "lighting.txt". Works seamlessly with .txt (raw text, YAML dicts, or multi-entry dict lists) and .json (saved prompts or data objects/arrays) relative to saved_prompts root or subfolders. Supports assigning to variables ($hero = @import "hero.txt";), direct loop iteration (for $m in @import "heroes.txt"), and 5-level recursion guards. |
| โก Reusable Macro Functions | Define parameterized prompt functions: fn hero($name, $weapon) = { masterpiece portrait of $name holding a glowing $weapon }; and invoke them anywhere with @hero("valkyrie", "sword"). Supports variable passing, multi-line bodies, and clean definition stripping. |
| ๐ฆ Arrays, Lists & Wildcard Data Structures | First-class data structures: declare lists $elements = [fire, frost, lightning]; and maps $hero = { name: "Valkyrie", role: "tank" };. Wildcard list files can also contain YAML key-values ($hero = __hero__; $hero.name, $hero.role) or multi-entry dictionary lists (__heroes__ rolls 1 random dict, __all$$heroes__ imports all into a list, or loop directly via for $m in __heroes__). Access items with dot notation ($hero.name), bracket indexing ($elements[0], $hero["weapon"]), or array lengths ($elements.length). Works with dedicated filters (| keys, | values, | first, | last, | reverse, | sort). |
| ๐ Loops & Repetition | Parametric generation loops: repeat(count) { ... } with auto $index (1-based) / $i (0-based) and re-rolling dynamic choices per iteration; for $item in $list { ... }, for $idx, $item in $list { ... }, dictionary key-value loops for $k, $v in $dict { ... }, multi-character squad loops for $m in $party { $m.name as $m.role }, and numerical ranges for $i in 1..4 { ... }. Bounded safely to 20 iterations max. |
| ๐ CASE / Switch Statements | Multi-branch conditionals that map variables to distinct character traits, outfits, or LoRAs: {case $person: man => sharp suit | woman => red dress | * => casual outfit}. Supports single-line with | or multi-line with newlines, comma grouping (man, boy => ...), and choice sets ({man|boy} => ...). |
| โ Compound Boolean Ternaries | Full boolean logic branching with &&, ||, and !: {$is_night && $weather == "rain" ? stormy night : clear day} or {($level >= 50 || $role in {paladin|hero}) && $is_night ? veteran : rookie}. |
| ๐ฒ Percentage Chance Modifiers | Probabilistic tag inclusion: {40%: dramatic volumetric dust, } or {25.5%: cybernetic arm} rolls a random percentage probability per generation, cleanly resolving to empty string if the chance fails. |
| ๐งฎ Inline Arithmetic Expressions | Real-time mathematical operations directly inside prompts or attention weights: (masterpiece:{$base_weight + 0.2}) (masterpiece:1.3), {$level * 2}, {$age + 10}. |
| ๐ก๏ธ Null-Coalescing Operator | Safe fallback resolution for unset or empty variables: $theme ?? "cyberpunk" or {$missing_var ?? "high tech"}. |
| ๐งช Unix / Jinja Filter Pipes | Transform variables with piped filters: $creature | plural | upper WOLVES, $tags | strip_weights (cleans tags to unweighted plain text), $colors | join(" + "), $hero | title, and $tag | weight(1.3). Safely isolated to never collide with dynamic choices! |
| ๐ฎ Seamless LoRA Prompt Tagging | Tag <lora:name:strength> directly inside your prompt or CASE branches. The Text Editor completely strips the tag from the text (no prompt pollution or metadata leaking) and invisibly transmits the LoRA payload to the ModusFlow LoRA Loader via the existing conditioning connection. |
| ๐ฒ Dynamic Choices & Pick-N | Standard choices {day|night}, Pick-N sets {2$$neon|retro|cyberpunk}, and weighted probabilities {80::sunny|20::rainy}. |
| ๐ Deterministic Sequencing | Step through options sequentially per queue or batch: {seq: dawn | midday | golden hour | midnight} loops systematically with each generation. |
| ๐ Synced Choice Tuples | Roll multi-variable attribute sets in lockstep: [$theme, $hair, $eyes] = {[fire, crimson, amber] | [ice, silver, blue]};. |
| โจ๏ธ Intelligent Autocomplete | Instant popup autocomplete triggered by <l (installed LoRAs with auto-normalized slashes), __ (wildcard list files), $ (variables), and % (workflow macros). |
| ๐ฏ Tag Weight Stepping | Highlight any tag and press Ctrl+Up / Ctrl+Down to step attention weights ((tag:1.1) (tag:1.2)), or wrap words with parentheses automatically. |
| ๐ Linguistic Weight Translation | Automatic real-time translation between SDXL/Pony token weights ((word:1.3)) and natural language emphasis for Chroma and Flux T5 (strikingly intense word, emphasizing word), Front-Load Priority mode, or clean weight stripping. |
| ๐ฆ Multiline Variable Blocks | Define reusable multiline variables with $character = { ... }; or triple quotes """ ... """, with full support for inline comments (//, /* */, #). |
| ๐ซ Inline Negative Injections | Inject negative constraints right where you think of them in the positive prompt with {!neg: blur, deformed}โautomatically deduplicated into the negative prompt. |
๐ Deep Dive Documentation: Check out the comprehensive ModusFlow Text Editor Documentation and the Text Editor & Wildcard Mastery Guide for advanced syntax examples, workflow integration patterns, and best practices.
-
Navigate to ComfyUI custom_nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/ModusFlow/ComfyUI-ModusFlow.git
-
Install dependencies:
cd ComfyUI-ModusFlow pip install -r requirements.txtInstalls core dependencies including
ultralytics(for YOLO detection in All-in-One Detailer) andav(for multi-format audio encoding in Save Audio). -
Restart ComfyUI
You can configure ModusFlow directly within ComfyUI without editing any files:
- Click the โ๏ธ Settings icon in ComfyUI (top bar or sidebar).
- Locate the ModusFlow category.
- Configure your settings directly:
- Ollama URL: Local Ollama server address (default:
http://127.0.0.1:11434) - Ollama Cloud URL: Remote Ollama endpoint URL
- Ollama Cloud API Key: Bearer token for authenticated remote Ollama servers
- Cloud API URL: OpenAI-compatible endpoint (default:
https://openrouter.ai/api/v1, Groq, DeepSeek, OpenAI) - Cloud API Key: API key for cloud LLM providers
- Cloud Models: Comma-separated list of cloud models for dropdowns
- Civitai API Key: For LoRA preview images and metadata
- Prompts Directory Override: Custom path for saved prompts and song libraries Changes apply immediately in real time.
- Ollama URL: Local Ollama server address (default:
Alternatively, create a config.json file in the node directory:
cp config.json.example config.jsonEdit config.json to configure:
ollama_url- Ollama API endpoint (default:http://127.0.0.1:11434)ollama_cloud_url- Remote/cloud Ollama endpointollama_cloud_api_key- Remote Ollama authentication tokencloud_api_url- OpenAI-compatible chat completions endpointcloud_api_key- Cloud LLM API keycloud_model- Default cloud model identifiercloud_models- List of pre-populated cloud modelsollama_timeout- Timeout in seconds for LLM requests (default:120)civitai_api_key- For LoRA preview images and metadataprompts_save_directory- Custom path for saved prompts (optional)base_model_definitions- Custom model architecture definitions (Flux, SDXL, Pony, etc.)
- ๐งญ Workflow & Node Usage Guide โ Step-by-step guide to connecting nodes, pipe-driven workflows, detailing passes, and upscaling.
- ๐ฆ Pony V6: Face & Quality Mastery Guide โ Secrets to generating clean, sharp, distortion-free faces, eyes, and anatomy in Pony Diffusion V6 XL.
- ๐ Text Editor & Wildcard Mastery Guide โ Model weight translation (Chroma/Flux T5 vs. SDXL/Pony), front-loading priority, tag shuffling
{shuffle: ...}, deterministic seeds, inline choices{a|b}, strictsaved_promptswildcards, and on-canvas list curation. - ๐ฅ๏ธ ModusFlow Studio Specification โ Architecture & technical specification for the standalone cross-platform Photino.Blazor desktop workstation.
AI & Prompt Enhancement
Model & Resource Loading
Sampling & Generation
- KSampler
- Batch KSampler
- Latent Preset
- Video Latent Preset
- Modus Dynamic Guidance
- ModusFlow Chroma Shift (Flow-Matching Timestep Shifting for Chroma & Flux)
- Img2Img & Fidelity Controller (All-in-One VAE Encode, Modular VAE Encode, Fidelity Slider, Load Image)
- VAE Decode & Latent Tools (Tiled VAE Decode, Latent Upscale / Hires Fix)
Image Enhancement & Post-Processing
- All-in-One Detailer
- Model Upscale (All-in-One) (Neural Model Upscale with Bypass & Downscaling)
- Upscaler (Diffusion Tiled Upscaling)
- Restormer
- Modus De-Wax Texture Restore
- Compare Images (A/B Split)
- Mask Tools (Grow/Shrink, Blur, Invert)
Video & Audio
Conditioning & Control
- ControlNet Suite (Pipe-Aware ControlNet Apply & Loader)
- Conditioning Concat
Utilities
- Show Text
- Text Editor (with Weight Translation, Dynamic Prompts & Wildcards)
- List Curator (Wildcard Curation & Sampling)
- Prompt Mixer (Modular Prompt Layer Builder & Stacker)
- Image Gallery
- Save Image
Pre-configured sample workflows with optimal defaults and pipe-driven architecture are provided in the workflows/ directory:
- Chroma Img2Img All-in-One (ModusFlow).json: Chroma 1-HD image-to-image workflow using the All-in-One
ModusFlow Img2Img VAE Encodenode with single-slider fidelity control (0โ100%) and 100% ModusFlow nodes. - Chroma Img2Img Modular (ModusFlow).json: Chroma 1-HD image-to-image workflow using separate
ModusFlow Load Image,ModusFlow VAE Encode, andModusFlow Fidelity Controllernodes. - Wan2.2 (ModusFlow).json: Production Wan 2.2 Video Diffusion workflow with native 48-channel latent masking for Image-to-Video (I2V) and Text-to-Video (T2V).
- Wan2.2 + MMAudio (ModusFlow).json: Wan 2.2 video generation with automated video-to-audio Foley synchronization via MMAudio, muxed into final MP4.
- DiffRhythm Song Studio (ModusFlow).json: Complete full-song vocal music studio with structured lyrics, style prompts, and 320kbps MP3 audio export.
- Wan2.1 (ModusFlow).json: Wan 2.1 Video Diffusion workflow with unified Text-to-Video (T2V) and Image-to-Video (I2V) toggle, spatio-temporal latents, and in-house video encoding.
- Wan2.2 Image (ModusFlow).json: Wan 2.2 Still Image Generation workflow with 48-channel 5D latents, Dynamic Guidance decay, full 12-slot detailing pipeline, and Restormer / 4x Remacri upscaling.
- Chroma (ModusFlow).json: Chroma 1-HD de-distilled Flux with CFG scale decay and anti-waxing pipe.
- Flux1.Dev (ModusFlow).json: Flux.1-dev with dual CLIP (T5 + CLIP-L) and distilled guidance decay.
- SD3.5 (ModusFlow).json: Stable Diffusion 3.5 Large with SGM Uniform scheduler and distilled guidance decay.
- SDXL (ModusFlow).json: SDXL base workflow with DPM++ 2M Karras, true CFG decay, and micro-texture restore.
- SD1.5 (ModusFlow).json: SD 1.5 checkpoint workflow with 512x512 latent preset and full detailing pass.
- Pony V6 (ModusFlow).json: Pony Diffusion V6 XL with CLIP skip -2, score prompt tags, and Euler Ancestral.
- Illustrious (ModusFlow).json: Illustrious-XL with CLIP skip -2, Danbooru anime tags, and Euler Normal.
Model Loader โ Multi-CLIP Text Encode โ KSampler โ VAE Decode
Eliminate plastic, waxy skin tones and over-baked contrast through a two-stage process (sampling decay + post-decode texture restoration):
[Model Loader] โโ PIPE โโโบ [Modus Dynamic Guidance] โโ PIPE โโโบ [KSampler] โโโฌโโ IMAGE โโโบ [Modus De-Wax Texture Restore] โโโบ [Save Image]
โโโ PIPE โโโบ
- Stage 1 (Sampling): Modus Dynamic Guidance dynamically decays guidance strength (e.g.
4.5โ1.8viacosinecurve). Preserves composition and prompt adherence in early steps while eliminating the synthetic plastic gloss and harsh saturation caused by constant guidance.- Chroma 1-HD / SDXL / Pony: Use
CFG Scale (Chroma / SDXL / SD1.5)mode (scale_start: 4.5,scale_end: 1.8-2.0). - Flux.1-dev / SD3: Use
Flux / SD3 (Distilled Guidance)mode (scale_start: 3.5,scale_end: 1.8, KSamplercfg: 1.0).
- Chroma 1-HD / SDXL / Pony: Use
- Stage 2 (Post-Processing): Modus De-Wax Texture Restore uses GPU-accelerated frequency separation and ITU-R BT.709 relative luminance weighting to amplify genuine skin pores (
micro_texture: 0.20-0.30) and inject subtle, organic sensor grain into skin mid-tones (grain_intensity: 0.05-0.08).
Text โ Ollama Prompt Refiner โ CLIP Text Encode โ Generation
KSampler โ image โ All-in-One Detailer โ Upscaler โ Save Image
- ComfyUI (latest version recommended)
- Python 3.8 or higher
- For Ollama nodes: Ollama installed with at least one model (
ollama pull llava) - For All-in-One Detailer:
pip install ultralytics(YOLO detection models) - For Restormer:
pip install einops - For Upscaler: Upscale models in
ComfyUI/models/upscale_models/
ComfyUI-ModusFlow includes an official companion extension for VS Code, Cursor, and Windsurf located in vscode-extension/:
- ๐จ Full ModusFlow Syntax Highlighting: Rich TextMate grammar for dynamic choices (
{a|b|c}), weighted odds ({80::day|20::night}), wildcards (__lighting__), variables ($var), attention weights ((tag:1.2)), and LoRA tags (<lora:name:weight>). - ๐ Document Color Provider & Natural Color Resolver: Live color swatches on
#hexcodes with built-in color picker and nearest natural color name resolution. - ๐ค Ollama Selection Inpainting: Highlight any word or phrase and right-click to expand, audition visual synonyms, wrap into
{choice|choice}blocks, or translate between tags and prose. - ๐ก Rich IntelliSense & Autocomplete: Autocomplete for installed wildcards (
__), LoRA models (<lora:), and prompt macros (!cine,!photo,!anime,!neg). - ๐ผ๏ธ LoRA Hover Cards: View Civitai preview thumbnails, authors, and trained trigger tags on hover.
- ๐ต Songwriter & Lyrics Studio Cockpit: Seamlessly switch between Image Prompts and Songwriter & Lyric Studio modes. Structure musical lyrics with live section syntax highlighting (
[Verse],[Chorus],[Bridge]), quick section ribbons, musical style pedals (Studio Master, Analog Warmth, Punchy 808, Radio Ready, Vocal Air, Acoustic Live, Atmospheric Strings), and save directly into your ComfyUI song collection. - ๐ Saved Songs & Lyrics Library: Dedicated sidebar tree view to browse, preview, and load saved songs grouped by genre and category directly from ComfyUI.
- ๐ Activity Bar Library Explorer: Browse saved prompts and edit wildcard files side-by-side.
- ๐ One-Key Generation Queue (
Ctrl+Alt+Enter): Trigger ComfyUI generation directly from your IDE.
Download the latest .vsix package from the Releases page or compile it locally, then install via:
code --install-extension vscode-extension/modusflow-prompt-studio-*.vsixOr in VS Code / Cursor / Windsurf: Press Ctrl + Shift + P $\rightarrow$ Extensions: Install from VSIX... $\rightarrow$ Select the downloaded .vsix file.
MIT License - see LICENSE file for details
- ComfyUI team for the excellent framework
- Ollama for local LLM capabilities
- Ultralytics for YOLO models
- Segment Anything team for SAM
- Community for feedback and testing
If you find ModusFlow helpful for your ComfyUI generation pipelines and prompt workflows, consider supporting ongoing development:
- Issues: Report bugs or request features
- Discussions: Ask questions and share workflows