Nodes/ComfyUI Prompt Companion/Prompt Companion: Subprompt to Strings
ComfyUI Node

Prompt Companion: Subprompt to Strings

What's actually inside that subprompt, as plain text

By jfcantu·Created 12 months ago·Updated 11 months ago· 8
Prompt Companion: Subprompt to Strings
  • subprompt
  • positive
  • negative

Subprompt to Strings is the pack's "out" converter - the exact mirror of Strings to Subprompt. You feed it a subprompt object, it returns the resolved positive and negative as plain strings you can hand to a standard CLIP Text Encode.

Every Prompt Companion chain ends here (or at Add Subprompt's string outputs). The checkpoint loader and Add Subprompt give you subprompt objects, which only mean something inside the pack; the moment you need real text for a Text Encode, this is the node that unwraps them. It's also quietly the best debugging tool in the pack: a subprompt can pull in other nested subprompts, and this is how you see what it all actually resolves to.

How it works

If the subprompt is simple - "attached" content with no nested references - the node just returns its positive and negative text directly. If it carries nested subprompt references, it loads your whole library from storage, resolves the nesting (with the pack's circular-reference protection), and returns the flattened result. Duplicate terms are removed, first occurrence wins, same as everywhere else in the pack.

One thing to appreciate: this is where the opacity ends. Whatever chain you built upstream - saved subprompts, trigger-word auto-loading, nested includes - collapses into two strings you can inspect, log, or pipe into a Text Encode.

Inputs and outputs

Single required input: subprompt (type *). Wire it from the checkpoint loader's subprompt output, from Add Subprompt, or from Strings to Subprompt.

Two outputs: positive and negative, both plain STRING. Feed positive into a CLIP Text Encode's text input and negative into the other one, and your prompt layer is done.

Installing it

Part of the ComfyUI Prompt Companion pack. In ComfyUI Manager, search "ComfyUI Prompt Companion", or:

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

Restart ComfyUI; it appears under prompt-companion. Dependency-wise it's just aiohttp, no models to fetch.

Gotchas

  • Feed it garbage and you get empty strings, not an error - the node degrades to ("", "") on bad input. If your output suddenly looks blank, check what's actually wired into subprompt rather than hunting for a crash.
  • It's a read-only converter: nothing you do here changes your saved library. The resolution is computed per run from the current storage, so update a nested subprompt in the editor and this node reflects it on the next run without any re-save.
Categoryprompt-companion

Inputs (1)

NameTypeDefaultDescription
subprompt*The subprompt object to convert to text strings

Outputs (2)

NameTypeDescription
positiveSTRING
negativeSTRING