KIE • Save Element
Locations and props need a picture, styles don't
- reference_image
- element
- element_prompt
What it is
The write half of the Elements feature: an approved, versioned record of a location, prop, or style, stored in ComfyUI's user data area so it outlives the workflow that created it.
Elements are the pack's answer to continuity paperwork. Your loft apartment appears in four shots and you need it to be the same loft each time. Rather than re-inventing the description from memory, save the approved reference once and load it wherever the scene returns.
How it works
You pick a kind - location, prop, or style - give it a name, a version, and a description of the visual definition. All four are required; blank any of them and the node tells you so rather than writing a broken record.
Then the rule that catches people: location and prop require exactly one reference image. Connect a single IMAGE to reference_image or you get "A location needs one approved reference image." Two images in a batch fails too - the check is on shape. Styles are exempt, which makes sense: a style can be a written definition with no single frame that represents it.
continuity_rules is optional and is the field that earns its keep. It's where you write the constraints - "same window arrangement in every shot", "the red kettle is always on the left burner". Those lines get appended to the element's prompt, so they travel with the reference into every generation that uses it.
On disk, each element becomes a folder at KIE-Nodes-Next/elements/<kind>__<slug(name)>__v<slug(version)>/, holding reference.png (if there is one) and an element.json manifest with the description, continuity rules, image hash, a content hash of the whole record, and a created timestamp. Writes stage into a .saving folder and rename into place - no half-written elements.
The outputs are the element handle and the assembled element_prompt. Hand the handle to KIE • Element Reference for the image, or to a downstream node that wants the record.
Immutability, and why you'll hit it
If the same name and version already exists with identical content, the save is a harmless no-op. If it exists with different content, you get "Element X v1 already exists with different content. Create a new version."
So a typo in your continuity rules means v2, not an edit. Annoying the first time, and exactly what you want the tenth time, when you're trying to work out why last month's render looked different from this month's.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
python -m pip install -r ComfyUI-KIE-Nodes-Next/requirements.txt
Pillow and numpy handle the image. No API key, no credits, no network. The node is an output node, so it writes every time you queue.
Where people get burned
- The element doesn't show up in Load Element. The dropdown is built at node-registration time. Save your first element, then refresh the node definition or re-add the node - a stale list showing
(no saved Elements)is the single most common "it's broken" report here. - Wrong kind.
stylewith no image is fine;locationwithout one isn't. If you only have an image and no words, you still need a description. - "An incomplete Element save exists." A
.savingfolder is lying around from an interrupted run. Look in the elements folder, inspect it, then clear it before retrying. - Names are keys.
City loftandcity loftare different elements. Pick a convention and keep it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| kind | COMBO | 3 options: location, prop, style | |
| name | STRING | — | |
| version | STRING | 1 | — |
| description | STRING | — | |
| reference_imageopt | IMAGE | — | |
| continuity_rulesopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| element | KIE_ELEMENT | — |
| element_prompt | STRING | — |