Nodes/ComfyUI Prompt Companion/Prompt Companion: Add Subprompt
ComfyUI Node

Prompt Companion: Add Subprompt

Your prompt library, merged into one node

By jfcantu·Created 12 months ago·Updated 11 months ago· 8
Prompt Companion: Add Subprompt
  • subprompt
  • subprompt
  • positive
  • negative
positive
negative
merge_orderinput,textbox,subprompt
subprompt_selection

If you've ever swapped checkpoints and then spent ten minutes remembering which negative embedding and quality keywords go with that model, this is the node that fixes it. Add Subprompt is the workhorse of ComfyUI Prompt Companion: it takes a subprompt you're already carrying, bolts on your own positive/negative text, optionally pulls in a saved subprompt from a dropdown, and hands back the merged result - both as a subprompt object and as ready-to-encode strings.

Why you'd reach for it

The author's whole pitch is keeping your prompts in sync with your workflows instead of hand-editing them. Concretely, this node is how you:

  • swap between embedding-based negatives like lazyneg when the checkpoint changes base model,
  • remember which quality keywords worked with which checkpoint,
  • keep the same style keywords across a whole set of character prompts and update them all in one place.

You edit each saved snippet once, in one dialog. The node does the assembly on every run.

How it works

Three sources get merged:

  1. subprompt - an existing subprompt wired in, e.g. from the pack's Load Checkpoint with Subprompt node or another Add Subprompt.
  2. subprompt_selection - a dropdown of subprompts saved in your library.
  3. positive / negative - the textboxes right on the node.

The merge_order dropdown (six permutations, default input,textbox,subprompt) controls which of those lands first. Under the hood the node resolves any nested subprompts against your library, joins the parts with ", ", and strips duplicate terms - so dog, golden retriever, dog quietly collapses to dog, golden retriever.

Inputs and outputs that matter

The two textboxes are multiline, and honestly they're where most people type the bulk of their prompt. merge_order is the one dropdown you'll actually touch. subprompt_selection starts empty; it only fills in after you've saved subprompts, which you do by right-clicking any Prompt Companion node and opening Edit Subprompts. Those persist to a subprompts.json under ComfyUI/user/<your_user>/prompt_companion/.

The outputs are subprompt (the combined object - wire it into another Add Subprompt or into Subprompt to Strings), plus positive and negative strings you can feed straight into a plain CLIP Text Encode. Because this node is flagged as an output node, that resolved text also shows up in its own UI slot, which makes it a handy live preview while you build.

Installing it

It ships in the ComfyUI Prompt Companion pack. Easiest route is ComfyUI Manager - search "ComfyUI Prompt Companion" and install. Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/jfcantu/ComfyUI-Prompt-Companion.git

Restart ComfyUI and the nodes appear under the prompt-companion category. The only Python dependency is aiohttp (which ComfyUI almost certainly already has), and there are no model downloads. Nothing heavy here.

Where people get tripped up

  • The dropdown showing [No Subprompts Found] isn't a bug - it's you having zero saved subprompts. Open the Edit Subprompts dialog and make one.
  • Duplicate removal is automatic and preserves the first occurrence. If you genuinely want a word to appear twice (attention-heavy prompters sometimes do), this node will quietly un-ask for it; you'd have to add the repetition after the fact, downstream.
  • The subprompt output is typed *, so ComfyUI won't warn you if you wire it somewhere it doesn't belong. The object only means anything to Prompt Companion's own nodes - keep it inside the pack.
Categoryprompt-companion

Inputs (5)

NameTypeDefaultDescription
positiveSTRINGAdditional positive prompt text to add
negativeSTRINGAdditional negative prompt text to add
merge_orderCOMBOinput,textbox,subpromptOrder in which input, textbox, and subprompt are merged (comma-separated)
subpromptopt*Existing subprompt to extend (optional)
subprompt_selectionoptCOMBOSelect a subprompt to apply

Outputs (3)

NameTypeDescription
subprompt*
positiveSTRING
negativeSTRING