Load Sidecar Prompt (.txt) – List
Reuse the Original Prompt Hiding Beside Every Image
- prompt_texts
The "sidecar" pattern is one of those things ComfyUI users keep re-inventing: an image named img001.png sits next to a text file named img001.txt that holds the prompt that made it. Load Sidecar Prompt (.txt) is the node that reads those files in bulk. Feed it a list of image filenames, and it returns the corresponding .txt contents as a list - perfect for re-running an old generation with tweaks, building a dataset of prompt/image pairs, or just recovering what you did last week.
It's from artyclaw/artyclaw-comfy, and it solves a problem that appears the moment you start organizing generations into folders with sidecar prompts. The display name's "â€" is just a mojibake dash from the pack's UTF-8 handling - ignore it; the node is fine.
How it works
For every filename in the input list, it:
- Strips the extension (
img001.png→img001). - Appends
.txt(img001.txt). - If that file exists, reads it and returns the full contents; if not, returns an empty string.
The output is a list that lines up one-to-one with the input filenames, so an image list and its prompt list stay index-aligned - which is exactly what you need when a batch node is iterating both. Missing sidecars don't error; they just produce empty strings, keeping the pipeline alive.
Inputs and output
One input, filenames - a multiline STRING marked forceInput, which means it's meant to be wired from a node that emits a list of filenames (like SimpleDirLoader's path_list or SimpleFolderParser's lists). One output, prompt_texts, typed STRING and flagged as a list (is_list: true), so ComfyUI knows downstream nodes will iterate it.
Install
ComfyUI Manager → search ArtyClaw Comfy Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/artyclaw/artyclaw-comfy
Restart. Pure Python stdlib (os).
Where people get burned
The big one is path resolution. The node looks for the .txt next to whatever path you hand it - if your filenames are bare names (img001.png) but the images live in a subfolder, it looks for img001.txt in the current working directory, not next to the images. Wire it from a node that outputs full paths and this disappears. Second, a filename with no extension still gets .txt appended to the whole string, so img001 → img001.txt (works) but img001.final → img001.final.txt (surprise). And sidecar files created by A1111-style tools sometimes have a trailing newline; the node doesn't strip it, so you may want a trim node downstream before the text hits an encoder. Small caveats, but they're the difference between "works" and "works on the first try."
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| filenames | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt_texts | STRING | — |