Nodes/comfyui-darkil-nodes/Dynamic prompt builder [darkilNodes]
ComfyUI Node

Dynamic prompt builder [darkilNodes]

A prompt builder that grows its own widgets from your text

By pytraveler·Created 7 months ago·Updated 15 days ago· 9
Dynamic prompt builder [darkilNodes]
    • compiled_prompt
    • extra_compiled
    prompt

    Most "prompt builder" nodes are glorified text concatenation. This one is a tiny template language: you type markers into the prompt text and the node spawns matching widgets on itself, so you reconfigure a prompt from the canvas without editing a wall of prose. It's the kind of node that looks like a gimmick until you've built one workflow that needs three swappable styles and you realize you just deleted four separate prompt nodes.

    The template language in one breath

    The core idea is that placeholders and toggle tags written in the text become controls on the node.

    • Placeholders {{NAME:TYPE:VALUE:DEFAULT:USE_INPUT}} create a widget. TYPE is STRING, INT, FLOAT, COMBO, SLIDER or KNOB; VALUE is the current value (or the min for numeric types); DEFAULT is the fallback (or the max); and USE_INPUT (true) exposes an input socket for that value instead of just a widget.
    • Toggle tags [[TAG]]…[[/TAG]] keep or drop the wrapped block via a per-tag switch. [[TAG:GROUP]] makes tags sharing a GROUP mutually exclusive - radio behavior - and tags nest.
    • Extra block [%extra%]…[%/extra%] compiles to a second output; the Vars block [%vars%]…[%/vars%] is deliberately ignored by the backend, so it's a scratchpad for notes that won't leak into your prompt.
    • Comments (//, #, /* … */) are stripped before processing - and // is only a comment at the start of a line, so URLs survive.
    • Spaceless blocks and formatting directives (lower, upper, title, sentence, trim, dedent, list, list_and, …) transform wrapped text and nest, which is how you get things like a proper Oxford-comma list out of a comma soup.

    There's even a syntax-highlighting editor with an Insert/Vars menu, validation underlines, and keyboard autocomplete, localized in English and Russian.

    Inputs and outputs

    The only real input is prompt (multiline STRING) - everything else lives in the text. There are also three inline switches on a compact bar: EDITOR (show/hide the editor), PROMPT (enable processing of the main prompt), and EXTRA (enable the extra block). Outputs are:

    • compiled_prompt (STRING) - the processed main prompt; empty if PROMPT is off.
    • extra_compiled (STRING) - the processed extra block; empty if absent or disabled.

    That second output is the sneaky-good feature: you can drive positive and negative prompt from one node, or keep a separate "detail text" channel for a text encoder that wants its own conditioning.

    Where people get burned

    The feature sprawl is the trap. The syntax-highlighted editor and directives are great, but if you over-nest placeholders and toggles you'll spend your evening debugging a template instead of generating. Start with one placeholder and one toggle tag; add the fancy stuff once the compile is stable. Also remember this is a text node - nothing here touches the sampler, so a "not working" complaint usually turns out to be the PROMPT switch flipped off or a stray [[/TAG]] mismatch.

    Installing

    It ships in the pytraveler/comfyui-darkil-nodes pack. In ComfyUI Manager, search ComfyUI-darkil-nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pytraveler/comfyui-darkil-nodes
    

    Restart ComfyUI and you're done - no Python deps, no models to fetch. It's the same install for every node in the pack, so if you're already running darkilNodes for the variable builders or toggles, this one's already there.

    CategorydarkilNodes/text

    Inputs (1)

    NameTypeDefaultDescription
    promptSTRING

    Outputs (2)

    NameTypeDescription
    compiled_promptSTRING
    extra_compiledSTRING