Extensions/ComfyUI Prompt Control
ComfyUI Extension

ComfyUI Prompt Control

Nodes for convenient prompt editing, making many common operations prompt-controllable

By asagi4·Created 3 years ago·Updated 2 days ago· 426
asagi4/comfyui-prompt-control
Nodes36
On cloudLocal install
Categorypromptcontrol/_testing, promptcontrol/tools
Stars426
Updated2 days ago

Nodes (36)

AttentionMaskHookExperimental

AttentionMaskHookExperimental — a raw attention-masking hook, explicitly for testing

promptcontrol/_testing
ConditioningCutoff

ConditioningCutoff — stopping one word's attribute from bleeding into another, BlenderNeko-style

promptcontrol/tools
CondLinearInterpolate

CondLinearInterpolate — smoothly blending between two prompts instead of hard-cutting

promptcontrol/exp
EditableCLIPEncode

EditableCLIPEncode — the old encoder node this pack has since replaced

promptcontrol/old
FilterSchedule

Pulling one tagged slice out of a Prompt Control schedule

promptcontrol
JinjaRender

Jinja2 templating for your prompt text

promptcontrol/tools
LoRAScheduler

Prompt Control's old LoRA node — use PC: Schedule LoRas instead

promptcontrol/old
PC: Attach Mask

Attach Mask — feeding regional masks to your prompt with IMASK()

promptcontrol/tools
PC: Attach Mask (multi)

Attach Mask (multi) — four regional masks in one node instead of a chain

promptcontrol/tools
PC: Anima attention Couple Model Patch

Anima Attention Couple Model Patch — regional prompting ported to Anima

promptcontrol/experimental
PCApplySettings

Attaching a PCScheduleSettings bundle to your Prompt Control schedule

promptcontrol
PC: Attention Couple (batch negative)

Attention Couple (batch negative) — keeping regional masks in sync across a batch

promptcontrol/v2
PC: Show Prompt

Show Prompt (PCExtractScheduledPrompt): the fastest way to debug Prompt Control syntax

promptcontrol/tools
PC: Schedule LoRAs

Schedule LoRAs — turn a LoRALoader into something that can fade LoRAs in and out over time

promptcontrol
PC: Schedule LoRAs (Advanced)

Schedule LoRAs (Advanced) — access to the raw hooks, plus multi-pass filtering

promptcontrol
PC: Schedule prompt

Schedule Prompt — A1111-style prompt scheduling in ComfyUI, without the noodle soup

promptcontrol
PC: Schedule prompt (Advanced)

Schedule Prompt (Advanced) — prompt scheduling with multi-pass filtering

promptcontrol
PC: LoRA Hooks From Text (non-lazy)

LoRA Hooks From Text (non-lazy): building a HOOKS object straight from LoRA syntax

promptcontrol/v2
PC: Expand Macros

Expand Macros — preview what your DEF macros actually turn into

promptcontrol/tools
PC: Extra argument helper for NODE

The node that shoves wires into your text prompt

promptcontrol/tools
PCPromptFromSchedule

Reading back the exact prompt text at a point in your schedule

promptcontrol
PC: Save Expanded Workflow (for debug)

Save Expanded Workflow (for debug): seeing the graph Prompt Control builds behind your back

promptcontrol/tools
PCScheduleAddMasks

Wiring up to four masks for regional prompting on the schedule path

promptcontrol
PCScheduleSettings

Step counts and SDXL micro-conditioning for a Prompt Control schedule

promptcontrol
PC: Configure Logging (for debug)

Configure Logging — turning up Prompt Control's debug output

promptcontrol/tools
PC: Configure PCTextEncode

Configure PCTextEncode — set your SDXL micro-conditioning and mask defaults once

promptcontrol/tools
PCSplitSampling

PCSplitSampling — toggling how Prompt Control handles schedule breakpoints during sampling

promptcontrol
PC: Text Encode (no scheduling)

Text Encode — the drop-in CLIPTextEncode upgrade that does most of Prompt Control's real work

promptcontrol
PC: Text Encode with Range (no scheduling)

Text Encode with Range — a slightly faster PCTextEncode when you already know the window

promptcontrol/tools
PCWrapGuider

Making Prompt Control's scheduling work inside SamplerCustomAdvanced

promptcontrol
PromptControlSimple

PromptControlSimple — LoRA scheduling and positive/negative encoding in one node

promptcontrol
PromptToSchedule

Turning A1111-style bracket syntax into something ComfyUI nodes can chew on

promptcontrol
ScheduleToCond

ScheduleToCond — turning a parsed prompt schedule into conditioning, for graph builders

promptcontrol
ScheduleToModel

Applying LoRA scheduling from a PROMPT_SCHEDULE straight onto your model

promptcontrol
SimpleWildcard

Seeded random text substitution, Prompt Control's take on A1111 wildcards

promptcontrol/tools
StringConcat

Joining up to four strings before they hit your prompt or template

promptcontrol/tools
Readme

ComfyUI prompt control

Control LoRA and prompt scheduling, advanced text encoding, regional prompting, and much more, through your text prompt. Prompt Control generates dynamic graphs that are literally identical to handcrafted noodle soup, condensing complicated workflows with dozens of nodes into simple text prompts.

Prompt Control comes with PCTextEncode, which provides advanced text encoding with many additional features compared to ComfyUI's base CLIPTextEncode.

A Basic Text to Image template is included with the extension, and can be loaded from ComfyUI's template library.

[!NOTE] v3.0.0 is backwards compatible with existing workflows, but requires at least ComfyUI v0.8.0 The parser was rewritten using parsy. It is intended to have the same behaviour as the old parser, but is significantly faster. Please report any bugs or incompatibilities you find.

What can it do?

  • A1111-style prompt scheduling and filtering without noodle soup.
  • LoRA loading and scheduling using ComfyUI's built-in hook system.
  • Masking, composition and area control (regional prompting) with an implementation of Attention Couple, also fully schedulable.
  • Advanced prompt encoding
    • Per-encoder prompts for models with multiple text encoders, such as SDXL and Flux.
    • Prompt combinators like BREAK, as well as CAT, AVG() and AND corresponding to ComfyUI's ConditioningConcat, ConditioningAverage and ConditioningCombine nodes.
    • Different weight interpretation types (ComfyUI, A1111, compel, etc.)
    • Prompt masking with an implementation of cutoff.
  • Organize complicated prompts with segments and prompt macros.
  • Schedule your own encoder nodes, allowing prompt control of eg. video or audio models with non-text inputs.

All features are fully schedulable unless otherwise stated. See the scheduling syntax documentation to get started.

If you find prompt scheduling inconvenient for some reason, PCTextEncode can be used as a drop-in replacement for CLIPTextEncode to get everything else.

This workflow shows LoRA scheduling and prompt editing and compares it with the same prompt implemented with built-in ComfyUI nodes. You can also find it in the template library.

Compatibility

Prompt Control uses graph generation, and tries to delegate functionality to core ComfyUI wherever possible, implementing any hooks and patches in a way that is maximally compatible. This means that it should just work in most cases, even with models and nodes not explicitly supported.

If you encounter issues as a user or if you're a node developer and Prompt Control somehow breaks something, feel free to file a bug report.

Requirements

The v3 node schema uses features that require at least ComfyUI v0.8.0

If you run into problems, update ComfyUI first.

Core nodes

Note: The documentation refers to the nodes with their internal names for consistency. The display name may change, but ComfyUI's search will always find the nodes with the internal name. PCLazyTextEncode and PCLazyLoraLoader are the main ones you'll want to use, also known as PC: Schedule Prompt and PC: Schedule LoRas.

PCLazyTextEncode and PCLazyTextEncodeAdvanced

PCLazyTextEncode uses ComfyUI's lazy graph execution mechanism to generate a graph of PCTextEncode and SetConditioningTimestepRange nodes from a prompt with schedules. This has the advantage that if a part of the schedule doesn't change, ComfyUI's caching mechanism allows you to avoid re-encoding the non-changed part.

for example, if you first encode [cat:dog:0.1] and later change that to [cat:dog:0.5], no re-encoding takes place.

The advanced node enables filtering the prompt for multi-pass workflows.

PCLazyLoraLoader and PCLazyLoraLoaderAdvanced

This node reads LoRA expressions from the scheduled prompt and constructs a graph of LoraLoaders and CreateHookLoras as necessary to provide the necessary LoRA scheduling. Just use it in place of a LoRALoader and use the output normally.

The Advanced node gives you access to the generated hooks. If you have apply_hooks set to true, you do not need to apply the HOOKS output to a CLIP model separately; it's provided in case you want to use it elsewhere. The advanced node also enables filtering the prompt for multi-pass workflows.

PCTextEncode

Encodes a single prompt with advanced (non-scheduling) syntax enabled. This is what actually does most of the work under the hood.

Note: PCTextEncode does not ignore <lora:...:1> and will treat it as part of the prompt. To use a combined prompt for LoRAs and your input, use PCLazyTextEncode and PCLazyLoraLoader

PCAddMaskToCLIP

This node attaches masks to a CLIP model so that they can be referred to when using the IMASK custom mask function of PCTextEncode.

PCSetTextEncodeSettings

This node configures PCTextEncode default values for some functions by attaching the information to a CLIP model.

Known issues

  • ComfyUI's caching mechanism has an issue that makes it unnecessarily invalidate caches for certain inputs; you'll still get some benefit from the lazy nodes, but changing inputs that shouldn't affect downstream nodes (especially if using filtering) will still cause them to be recomputed because ComfyUI doesn't realize the inputs haven't changed.

  • Cutoff does not work with models that use non-CLIP text encoders, like Flux. This might be fixable, but it's uncertain if cutoff even makes sense for those models.