Prompt Context Merge
Combine variable context from separate prompt chains
- context_a
- context_b
- context_c
- DICT
Adaptive Prompts threads variables through a workflow using a context object - you assign a variable in one Prompt Generator with __thing^name__ syntax, wire context out to the next node, and __^name__ resolves downstream. That works fine for a single linear chain. The moment you branch into two or three separate generator chains - one building character details, one building environment tags, say - each builds its own independent context, and nothing downstream can see variables from more than one of them until you merge those contexts together. That's the entire job of PromptContextMerge.
How it works
It's plumbing, not processing. It takes up to three context inputs and combines them into a single output DICT carrying every variable from all of them. There's no transform, no priority logic exposed to you beyond however dictionary merging naturally resolves a name collision - if two of your input chains happen to assign the same variable name, expect one to win over the other rather than both surviving, so keep variable names distinct across parallel chains if you're relying on all of them.
The inputs and outputs that matter
context_a,context_b,context_c- all optional, wire in two or three depending on how many chains you're combining.- Output: a single merged
DICT- feed this into whichever Prompt Generator (or further chain) needs to retrieve variables assigned anywhere upstream.
How to install it
It ships with the rest of the pack. Install via ComfyUI Manager by searching comfyui-adaptiveprompts, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Alectriciti/comfyui-adaptiveprompts
Restart ComfyUI afterward. No models, no extra dependencies - this is one of the lightest nodes in an already lightweight pack.
Common issues & troubleshooting
A variable that should exist doesn't show up. Check both ends of this node: are all the contexts you actually need wired into context_a/b/c, and is the merged output actually routed into whatever downstream generator is trying to retrieve the variable? It's an easy node to place correctly in the middle of a graph and then forget to actually connect its output onward - at that point it's done nothing.
Two chains use the same variable name and one silently disappears. That's a naming collision, not a bug in the node. Since there's no visible priority control here, the safest fix is upstream - rename the variable in one of the source chains (SetPromptVariable or the inline ^name in a Prompt Generator) so they don't collide in the first place, rather than relying on merge order to sort it out for you.
You only have one context chain. You don't need this node at all in that case - just wire the single chain's context output directly into the next generator's context input. PromptContextMerge only earns its place once you've genuinely got two or more independent chains to reconcile.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| context_aopt | DICT | — | |
| context_bopt | DICT | — | |
| context_copt | DICT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DICT | DICT | — |