Expert Text Prompt (Wildcards & AST)
A prompt node that parses its own syntax — wildcards, weights, and negative routing
- positive
- negative
- combinations
- debug_info
The name is doing a lot of work. "Expert Text Prompt" sounds like one of those nodes that phones an LLM to rewrite your prompt - it doesn't. It's a purely local parser that turns one template prompt into the two plain-text prompts your sampler actually needs. You've seen the dumb version of this: people wrap {cat | dog | fox} in a prompt and batch, hoping each run rolls a different subject - the classic wildcard trick from the A1111 era that most ComfyUI arrivals never learned. This node takes that idea, adds probability weights, optional-tag skip chances, named groups you can mute or solo, and the genuinely useful bit: inline negative routing. And because it parses the whole thing into an AST, it can tell you when you typo'd instead of silently mis-generating.
What it actually does
In a stock workflow your positive prompt is a text widget on a CLIP Text Encode node. This node slots in before that: you feed it a template, it resolves all the {options} and control syntax, then spits out two clean strings - wire positive into CLIP Text Encode (Positive) and negative into CLIP Text Encode (Negative). Nothing else in your graph changes. It's pure Python with zero dependencies - no models, no API key, no torch. The "AST" in the display name is real: the prompt is parsed into a token tree and resolved deterministically from your seed via random.Random(seed), so the same seed gives the same choices every time.
The syntax that matters
Three things earn the install:
{option A | option B | option C}- pick one, equal chance. Nesting works, and you can weight it:{70% red | 30% blue}. Add a skip chance with{20%? sunglasses}for "only sometimes present" tags, or a number range{18-50}for ages and years.-tag- prefix any tag with a dash and it's stripped out of the positive output and injected into your negative. That's the killer feature: your negative gets context-specific terms automatically. Write{sunny day, -sunglasses | rainy day, -umbrella}and whichever option rolls, the matching unwanted object lands in the negative and nowhere else.//mute and!solo -// blurry linesdisables a tag without deleting it;! red dressmakes only the marked tags survive. Groups ([GRP:NAME]) extend both to whole prompt blocks.
Inputs and outputs
You mostly touch two inputs. positive_prompt is the template with all the syntax above. negative_prompt defaults to the literal $negative, which is a placeholder: extracted - tags get injected exactly there. negative_mode decides what happens when there's no placeholder - prepend shoves extracted tags at the start of your negative, append at the end, replace overwrites it entirely, and the default auto falls back to prepending. seed drives which options roll; leave it wired to the same source as your sampler so prompt and image stay in lockstep.
The positive and negative string outputs go to your two CLIP Text Encode nodes. The other two are debug gravy: combinations is an INT telling you how many distinct outputs the template could produce (handy before you batch), and debug_info shows syntax errors with ^ caret pointers plus the resolved result. If you botch a bracket, it tells you exactly where, which is more than most prompt nodes will ever do for you.
Installing
Via ComfyUI Manager, search "ComfyUI Expert Wildcard Prompt" and install. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/v3rm1ll1on/ComfyUI-Expert-Wildcard-Prompt.git
Restart ComfyUI. There's no requirements.txt in the repo - nothing heavy hides behind the install. The node appears under prompt/expert as Expert Text Prompt (Wildcards & AST).
Where people trip
The big one: this is inline-only. Many wildcard packs (the A1111-style ones) load {filename} from a folder of text files. This node has no file loading - every option lives inside the prompt string. If you imported a library of wildcard text files expecting them to work, they won't, and nothing will warn you; that plain text just passes through. Related gotcha: if you use no special syntax at all, the node is a straight passthrough - harmless, but also pointless; reach for it when you want one template to fan out across many batches.
Also remember it's a string processor, not a model: extracted - negatives only help if you already write useful negatives - a long junk negative plus auto-injected tags can fight your positive. And an honesty note: this is a young, single-commit pack (v1.0.0, MIT, no community footprint yet). The parser ships a solid test suite, which is reassuring, but treat it as early software - if you hit a parse bug, the GitHub issues page is where it gets fixed.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| positive_prompt | STRING | — | |
| negative_prompt | STRING | $negative | — |
| negative_mode | COMBO | auto (use $negative) | 4 options: auto (use $negative), prepend, append, replace |
| seed | INT | 00–18446744073709550000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| positive | STRING | — |
| negative | STRING | — |
| combinations | INT | — |
| debug_info | STRING | — |