ArtificialGuyBR

Home / Blog / Prompting and control

A1111/Forge Prompt Tooling: Wildcards and Dynamic Prompts

Compare extensions that clean prompts, generate variations, and manage character libraries in A1111 and Forge — with verified features and common errors.

8 sources cited Prompting and control

TL;DR


What each tool actually does

sd-webui-prompt-format — cleanup for tag-based prompts

This extension runs whenever you click Generate in A1111 or Forge, or manually via Alt+Shift+F [^1]. Settings live under the Prompt Format section in the System category: Feature | What it does | Limitation

|---|---|---

Remove extra spaces and commas | Collapses repeated whitespace and stray commas | Only within the same line Fix misplaced brackets, commas, periods | Repairs syntax like tag,, tag or tag . | Only within the same line Remove Duplicates | Deletes identical tags | Only tag-based prompts; skips sentence-style prompts Remove Underscores | Replaces _ with space | — Append comma every line break | Ensures tag separation across lines | — Clean Booru paste noise | Strips danbooru/gelbooru metadata | — The duplicate remover is line-local — it will not catch a tag that appears on line 1 and again on line 3. It also does nothing for natural-language prompts. The README notes this explicitly: "Only checks within the same line ... Only works for tag-based prompt, not sentence-based prompt" [^1].

Manual trigger: Alt+Shift+F. Auto mode can be toggled off if other extensions (e.g., tagcomplete) re-trigger on the formatter's edits.


sd-dynamic-prompts — template language + wildcard engine

This extension adds a template language to A1111/Forge. Core syntax from the official tutorial [^2]: Syntax | Behavior | Example

|---|---|---

{a\|b\|c} | Pick one option per generation | a {gold\|platinum} band {{a\|b}\|c} | Nested variants | {{rose\|yellow\|white} gold\|platinum} __name__ | Load name.txt from wildcards folder | __gems__ → every line in gems.txt {N$$__name__} | Pick N distinct entries from wildcard | {2$$__artists/illustrations/childrens_books__} {N-M$$__name__} | Pick between N and M entries | {2-4$$__wildcard__} {N$$ and $$__name__} | Custom separator | Uses and instead of comma # comment | Ignored inside braces | {# this is ignored} Combinatorial mode enumerates every combination instead of sampling one branch — useful for batch grids.

Built-in features (same tutorial):

Wildcard files are plain .txt (one entry per line) stored under extensions/sd-dynamic-prompts/wildcards/. You must restart the web UI after editing them — this is confirmed by the sd-dynamic-prompts tutorial [^2] and also noted in the C0rn_Fl4k3s megapack guide [^6].


Character databases — BoChars and the C0rn_Fl4k3s megapack

Two large community collections illustrate the pattern: Collection | Format | Reported scope | Notes

|---|---|---|---

BoChars (DonMischo) | Single merged YAML | Cyberpunk / regular / magical / sci-fi character categories; clothing, constructions, cosmic, creatures, scenes | Uses __BoChars/person/male__ style paths; claims cross-wildcard reuse via shared properties (colors, fabrics, materials) [^5] Dynamic Wildcard Megapack (C0rn_Fl4k3s) | 154 wildcards, bundle + AllInOne | Basemodel (gender, ethnicity, 15F/23M builds, ~40/45 hairstyles), locations (770+ places, 5,150+ variants), costumes, creatures, objects, scenes | All counts are author-reported; we could not open the published files to verify [^6] DonMischo fantasy resources (article 3432) | Civitai article | Curated checkpoints, LoRAs, and wildcards for fantasy creatures | Lists 20+ creature LoRAs and wildcard packs for fantasy art [^7] Both follow the __path__ convention so they work with sd-dynamic-prompts. The extension resolves __key__ tokens against .txt files in its wildcards folder — it does not parse YAML structure [^2] [^3].


Cross-tool: ComfyUI Impact Pack

The ComfyUI-Impact-Pack repo contains custom_wildcards/ and wildcards/ directories at its root [^4] and links to a wildcard tutorial. This confirms wildcard support exists in ComfyUI, but the exact syntax and feature parity were not verified in this session — treat as a separate implementation, not a drop-in replacement.


Common errors and fixes

Symptom | Cause | Fix | Source

|---|---|---|---

Formatting triggers other extensions (tagcomplete, etc.) | Extensions listen to text-edit events | Disable "update actual prompts" in prompt-format settings, or switch to manual Alt+Shift+F | [^1] Duplicate tags remain after cleanup | Implementation is line-local and tag-mode only | Don't rely on it for sentence-style prompts; dedupe upstream | [^1] Edited wildcard file not reflected | Wildcards are read on launch | Restart the web UI after any wildcard edit | [^2] [^6] Booru paste leaves site tags (artist:name, rating:safe) | Metadata copied with prompt | Enable "Clean up unwanted texts when pasting from Booru sites" in prompt-format | [^1] Need prompt variation but only have a subject | Boilerplate quality too low | Use Magic Prompt (context-aware) or I'm feeling lucky (Lexica search) | [^2]


FAQ

Do wildcard files reload without restart in A1111? No. The C0rn_Fl4k3s megapack guide notes that after editing wildcard files, you must restart the web UI for changes to take effect [^6]. The sd-dynamic-prompts tutorial also confirms wildcard files are read on launch [^2].

Does ComfyUI Impact Pack use the same __name__ wildcard syntax as sd-dynamic-prompts? The Impact Pack repo contains wildcard directories and a tutorial link, but we did not open the tutorial file in this session [^4]. Syntax parity should be verified against the Impact Pack docs before assuming drop-in compatibility.

Do duplicate-tag removers in prompt extensions affect sentence-based prompts? No. The prompt-format README documents: "Only works for tag-based prompt, not sentence-based prompt" [^1]. It operates on comma-separated tokens within a single line.

What's the difference between Magic Prompt and I'm feeling lucky? Magic Prompt uses a downloaded neural network to expand a subject contextually. I'm feeling lucky queries Lexica.art for existing user prompts matching your input. Both are in sd-dynamic-prompts [^2].

Can I use BoChars YAML directly in sd-dynamic-prompts? Only if the YAML is flattened to __key__ token paths that match .txt files in the wildcards folder. The extension does not parse YAML structure — it only resolves __path__ lookups against text files [^2] [^5].

Does combinatorial mode work with Magic Prompt? The tutorial documents them in different sections [^2]. Combinatorial expansion enumerates template variants; Magic Prompt generates new prompt text from a neural net. They serve different workflows.

Are the large counts (154 wildcards, 770+ locations) verified? No. Those figures come from the Civitai articles themselves [^5] [^6]. We could not open the published wildcard files to independently confirm.


Sources

[^1]: sd-webui-prompt-format README — features, limitations, license: https://github.com/Haoming02/sd-webui-prompt-format [^2]: sd-dynamic-prompts tutorial — syntax, wildcards, combinatorial, Magic Prompt, I'm feeling lucky, Attention grabber: https://raw.githubusercontent.com/adieyal/sd-dynamic-prompts/main/docs/tutorial.md [^3]: sd-dynamic-prompts repo — project description: https://github.com/adieyal/sd-dynamic-prompts [^4]: ComfyUI-Impact-Pack repo — wildcard directories: https://github.com/ltdrdata/ComfyUI-Impact-Pack [^5]: Civitai article 1365 — BoChars structure and extension guide: https://civitai.com/articles/1365 [^6]: Civitai article 6301 — C0rn_Fl4k3s megapack, basemodel, locations: https://civitai.com/articles/6301 [^7]: Civitai article 3432 — DonMischo fantasy creature resources: https://civitai.com/articles/3432 [^8]: Civitai article 255 — prompt-format feature summary: https://civitai.com/articles/255