asagi4/comfyui-prompt-control
ComfyUI nodes for prompt editing and LoRA control
ComfyUI Prompt Control
This is a ComfyUI extension that lets you control complex AI image generation workflows using plain text prompts instead of manually connecting dozens of nodes.
What it does
In ComfyUI, complex workflows (like scheduling when a prompt changes or loading different LoRAs at different steps) require building a messy "noodle soup" of interconnected nodes. This tool parses a special text syntax and automatically generates that node graph for you. It handles prompt scheduling, LoRA loading, advanced text encoding, and regional prompting all from a single text box.
Key features
- Prompt Scheduling: Switch between prompts at specific steps (e.g.,
[cat:dog:0.1]changes from cat to dog at 10% of the generation). - LoRA Scheduling: Load and schedule LoRAs (fine-tuned model adapters) using ComfyUI's built-in hook system.
- Advanced Text Encoding: Use the
PCTextEncodenode for per-encoder prompts (useful for SDXL/Flux which have multiple text encoders), prompt combinators likeBREAKandAND, and different weight interpretation styles. - Regional Prompting: Implement Attention Couple to apply different prompts to different areas of the image (e.g., a dog in the background, a cat in the foreground).
- Lazy Graph Execution: Nodes like
PCLazyTextEncodeonly re-encode the parts of the schedule that actually change, making iterations faster. - Macros & Segments: Organize very complex prompts into reusable segments.
How it works
You write a prompt with special syntax. The extension's parser (rewritten in the parsy library for speed) reads this text. Then, nodes like PCLazyTextEncode and PCLazyLoraLoader dynamically build the underlying ComfyUI graph of standard nodes (like CLIPTextEncode and LoraLoader) on the fly. It delegates the heavy lifting to ComfyUI's core engine, so it stays compatible with most models and other custom nodes.
Use cases
- Creating complex, dynamic image workflows without manually wiring dozens of nodes.
- Switching between subjects or styles at specific steps of generation.
- Applying different LoRAs at different times during the generation process.
- Doing regional prompting (e.g., controlling foreground vs. background elements) from a single text prompt.
Notable technical details
- Requires ComfyUI v0.8.0 or higher (v3.0.0+).
- Backwards compatible with existing workflows.
- The
Cutofffeature (for prompt masking) does not work with non-CLIP text encoders like those used in Flux models.
Related
- Project
- Project
- Project
- Project
- Project