Template Reference
Keep your text and image references inside the graph, not in a folder
- select_text
- select_image
- template_json
Every real project starts the same way: a folder of reference images, a notes file with the prompt snippets you keep reusing, and you alt-tabbing between all of it while you rebuild the workflow. Template Reference is the answer to that mess - it parks the references inside the graph, as editable blocks in the node itself, and hands whatever block you select to the rest of your workflow.
The pitch is simple: hit Add Textbox for a text block, Add LoadImage for an image block, and you get a little library you can reorder by dragging, collapse, copy, and delete from the node UI. Then the Output dropdown picks which block is "live." Pick the image block and the node pushes that image out; pick a text block and you get its text. Swap blocks and the downstream graph re-runs. It's a clipboard with a graph port.
Why would you bother, versus just loading the file? Because reference choice becomes part of the workflow, not a separate step. On an SDXL/Illustrious setup, character and style refs typically feed an IP-Adapter or ControlNet node - the same mechanism the KB's character-consistency essay leans on for keeping identity across generations. Template Reference is a tidy way to A/B several refs from one spot, and because the state rides in the workflow's JSON, your reference library is portable with the graph instead of living in your head.
How it works
The clever bit is that the node is mostly a JSON passthrough. All the block editing happens in a custom frontend; the result is serialized and fed back through the template_json input (a STRING with a default of {"version":1,"items":[]}). On execute, the node parses that JSON, finds the block matching the selected id, and outputs its text or loads its image. No API, no hidden server, no Python deps beyond ComfyUI itself.
Two behaviors worth knowing. Images are not embedded in the JSON - the extension copies uploaded files into ComfyUI/user/template_reference/reference_templates/image/ and stores metadata instead. And if a saved image can't be found, the node doesn't hard-fail your whole queue; it returns a small placeholder and logs a warning. That's a genuinely thoughtful touch for a node whose data lives outside the workflow.
The inputs and outputs that matter
The input side is a single field - template_json - and you should treat it as UI-owned. Don't hand-edit it; the tooltip calls it "serialized text and image reference blocks edited by the custom UI," and that's exactly what it is.
The outputs are where you wire it in:
select_text(STRING) - the selected text block. Feeds any text port: a CLIP Text Encode, a prompt merge node, a note you want visible in the graph.select_image(IMAGE) - the selected image block. Goes straight into an IP-Adapter, ControlNet, or image-to-video conditioning input.template_json(STRING) - the normalized node state, echoed back. Mostly useful if you want to snapshot or inspect what's actually selected.
Installing it
ComfyUI Manager can find it by searching ComfyUI-TemplateReference, or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/Tsubasa109/ComfyUI-TemplateReference
Restart ComfyUI. That's the whole install - there's no requirements.txt, no model downloads, no torch rebuild. It's a lightweight frontend-plus-parser job from a Japanese dev (Tsubasa109), Apache 2.0 licensed, and genuinely new; as of mid-2026 it has basically no community footprint yet, so treat it as a fresh tool, not a proven one.
Where people get burned
- Images aren't in the JSON. Move machines or delete
user/template_reference/and your blocks load but show placeholders. Back up that folder with your workflow. - UTF-8 no BOM, always. The JSON stores non-ASCII (including Japanese) as-is, so if you open a template file in an editor that isn't UTF-8, text garbles.
- Nothing outputs? You've almost certainly got the Output dropdown on "none" or the block list toggled off. Check those before assuming a bug.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| template_json | STRING | {"version":1,"items":[]} | Serialized text and image reference blocks edited by the custom UI. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| select_text | STRING | — |
| select_image | IMAGE | — |
| template_json | STRING | — |