Sign In

How to use ComfyUI-DynPromptSimplified for dynamic prompting

1

How to use ComfyUI-DynPromptSimplified for dynamic prompting

Mastering Dynamic Prompting with ComfyUI-DynPromptSimplified

DynPromptSimplified node (available at its GitHub repository or comfy registry) takes prompting to the next level by enabling dynamic, randomized, and reproducible variations in your prompts. This node allows you to create flexible prompts that can generate diverse outputs without manually rewriting them each time. It supports simple choices via curly brackets, wildcards for loading options from files, and mirrored wildcards for handling complementary selections—especially useful for managing unwanted elements in models or LoRAs.

In this article, we'll dive into how to use the node, starting with basic curly bracket choices and building up to advanced combinations with wildcards and mirrored wildcards. We'll also cover nesting, the purpose of mirrored wildcards, and how selections work under the hood.

Introduction to DynPromptSimplified

DynPromptSimplified is a custom node for ComfyUI that expands prompts dynamically. It processes your positive and negative prompts, replacing placeholders with selected options based on a seed for reproducibility. Key inputs include:

  • Positive Prompt: Your main prompt text.

  • Negative Prompt: Text to avoid in generations.

  • Seed: Controls randomness—same seed yields the same selections.

  • Wildcard Directory (optional): Folder for wildcard files (defaults to a subfolder in the node directory), can be located anywhere on your device.

  • Auto Negative from Mirror (checkbox): Automatically injects mirrored wildcard complements into the negative prompt. If unselected -mir wildcards will act like normal wildcards.

  • Variety (0-10): Adds extra randomness lanes for exploring alternatives without changing the seed.

The node outputs expanded positive and negative text prompts, which you can feed into your sampler or other nodes. Outputs are deterministic: the same inputs always produce the same results, and adding fixed text won't shift selections.

To get started, install the node by copying the repository folder into ComfyUI/custom_nodes/ComfyUI-DynPromptSimplified and restarting ComfyUI. Place wildcard files (plain text files with line-separated options) in the wildcards subfolder or specify a custom directory. Or add via comfy registry. Do you use webui-forge? here is the forge version

Using Curly Brackets for Simple Choices

The simplest way to add dynamism is with curly brackets {} for choices. These act like a decision point where the node picks one option from a pipe-separated list (). Selections are deterministic based on the seed, so you can reproduce results reliably.

For example, in your positive prompt:

text

A beautiful {landscape|portrait|still life}, with {vibrant|muted|pastel} colors
  • The node will select one from {landscape|portrait|still life} and one from {vibrant|muted|pastel}.

  • If your seed is 42, it might expand to: "A beautiful portrait, with muted colors".

  • Changing the seed or variety shifts the picks, but fixed text (like "A beautiful" or commas) doesn't affect them—only the order and number of {} blocks do.

You can nest curly brackets inside each other for more complex hierarchies:

text

A {cinematic|studio|{outdoor|indoor}} scene

This treats the inner {outdoor|indoor} as a sub-choice if the outer picks the nested option. Nesting can go as deep as needed, and the node processes them recursively in multiple passes to handle all levels.

Curly brackets alone are great for quick variations without external files. They're ideal for testing prompt ideas or creating batches of similar images with controlled differences.

Wildcards

Wildcards take choices further by loading options from text files, allowing you to manage long lists separately. A wildcard is denoted by double underscores: __wildcard_name__.

  • Create a file like wildcards/colors.txt with one option per line:

    text

    red
    blue
    green
    yellow
  • In your prompt: "A flower in colors tones".

The node reads the file, treats each line as a choice (like a {red|blue|green|yellow}), and picks one based on the seed. If the file doesn't exist, the wildcard is simply removed.

Each line in the wildcard file can itself contain curly brackets or other wildcards, enabling modular prompts. For instance, if colors.txt has:

text

{vivid red|crimson}
{deep blue|navy}

The selection will expand the nested curly brackets too.

Wildcards advance the decision counter just like curly brackets, ensuring determinism. You can use them in both positive and negative prompts for balanced control.

Mirrored Wildcards: Purpose and Usage

Mirrored wildcards (denoted as name-mir) are a specialized feature designed to handle scenarios where a model or LoRA tends to insert certain elements unless explicitly excluded in the negative prompt. For example, some LoRAs might always add hats or accessories to characters unless you negate them. Manually listing exclusions is tedious, especially with random selections.

A mirrored wildcard solves this automatically:

  • It loads options from a file like wildcards/hats-mir.txt (note the -mir suffix; the node requires this exact naming).

  • The selected option goes into the positive prompt.

  • All unselected options (the "complement") are added to the negative prompt, comma-separated and deduplicated.

Example:

  • hats-mir.txt:

    text

    fedora
    baseball cap
    beanie
  • Positive prompt: "A person wearing __hats-mir__".

  • If "fedora" is selected:

    • Positive: "A person wearing fedora".

    • Negative (auto-injected): "baseball cap, beanie".

This ensures the model focuses on the chosen hat and avoids the others. If "Auto Negative from Mirror" is enabled, the node handles injection seamlessly—even if the negative prompt is blank. Without it, you'd need to include hats-mir in the negative prompt manually to trigger the complement.

Mirrored wildcards are strict: the file must exist (no fallback removal), and they're flattened to leaf options for the complement logic. They're perfect for "exclusive" choices where only one variant should appear, preventing model biases or LoRA over-insertions.

Example Positive Prompt (what you type into the node)

text

(masterpiece, best quality), a {highly detailed|cinematic|dreamy} portrait of a young woman, 
wearing __clothing-style__, __hair-style__, __accessory-mir__,
standing in a __environment__, soft {volumetric|golden hour|ethereal} lighting, 
sharp focus, intricate details

Three Normal Wildcards and Their File Contents

Place these as plain .txt files in your wildcards folder:

  1. clothing-style.txt

    text

    elegant black evening dress
    vintage floral sundress
    modern white blouse and high-waisted jeans
    gothic lace corset top
    cozy oversized sweater
  2. hair-style.txt

    text

    long flowing waves
    messy bun with loose strands
    sleek high ponytail
    soft beach waves
    asymmetrical bob cut
  3. environment.txt

    text

    misty enchanted forest at dawn
    rooftop garden under city lights
    sunlit Victorian library
    serene Japanese zen garden
    dramatic stormy cliffside by the sea

Three Mirrored Wildcards and Their File Contents

These must end with -mir in the filename so the node recognizes them as mirrored:

  1. accessory-mir.txt

    text

    delicate pearl necklace
    statement silver choker
    golden hoop earrings
    small floral hair clip
  2. glasses-mir.txt (we'll use this one too in a variation later)

    text

    round vintage glasses
    cat-eye sunglasses
    thin rimless frames
  3. hat-mir.txt (optional extra – shown in variation)

    text

    wide-brimmed sun hat
    black beret
    newsboy cap

How It Expands (Example Expansions)

The exact result depends on your seed, but here are three plausible expansions with different seed values to show variety. Assume "Auto Negative from Mirror" is enabled.

Expansion 1 (Seed gives these picks)

Positive becomes:

text

(masterpiece, best quality), a highly detailed portrait of a young woman, 
wearing elegant black evening dress, long flowing waves, delicate pearl necklace,
standing in misty enchanted forest at dawn, soft volumetric lighting, 
sharp focus, intricate details

Negative gets auto-injected from mirrored wildcards (only one mirror used here):

text

statement silver choker, golden hoop earrings, small floral hair clip

Expansion 2 (Different seed)

Positive:

text

(masterpiece, best quality), a cinematic portrait of a young woman, 
wearing modern white blouse and high-waisted jeans, sleek high ponytail, statement silver choker,
standing in rooftop garden under city lights, soft golden hour lighting, 
sharp focus, intricate details

Negative auto-added:

text

delicate pearl necklace, golden hoop earrings, small floral hair clip

Expansion 3 (Another seed – showing more curly bracket variation)

Positive:

text

(masterpiece, best quality), a dreamy portrait of a young woman, 
wearing gothic lace corset top, asymmetrical bob cut, golden hoop earrings,
standing in sunlit Victorian library, soft ethereal lighting, 
sharp focus, intricate details

Negative auto-added:

text

delicate pearl necklace, statement silver choker, small floral hair clip

Bonus Variation – Using an Extra Mirrored Wildcard

If you change the prompt slightly to include two mirrored wildcards:

text

... wearing __clothing-style__, __hair-style__, __accessory-mir__ and __glasses-mir__,
standing in __environment__ ...

Example expansion: Positive:

text

... wearing cozy oversized sweater, messy bun with loose strands, small floral hair clip and thin rimless frames, ...

Negative auto-added (combined & deduplicated):

text

delicate pearl necklace, statement silver choker, golden hoop earrings, round vintage glasses, cat-eye sunglasses

This is the main strength of mirrored wildcards: you get only one accessory/glasses style in the positive while automatically banning all the others in the negative — perfect when your model/LoRA loves to over-insert jewelry or eyewear.

Feel free to copy-paste the prompt above and create those wildcard files to test it yourself. Change the seed (or use Variety = 2–4) to see different combinations instantly!

1