StackPushString
Save a prompt (or any text) to disk so the next workflow can pick it up
StackPushString writes a text value to a stack on disk so a different workflow - or a later run of the same one - can pull it back with StackPopString. It's the smallest useful unit of the ComfyUI-Stacker pack: one string in, one file out.
Why would you want that? The pack's whole trick is decoupling heavy model loads. Workflow A renders images with an SDXL checkpoint; workflow B feeds them into an image-to-video model. Workflow B also needs the prompt that made the image - and rather than hardcode it or keep it in sync by hand, A pushes the prompt text onto a string stack and B pops it. Same idea works for negative prompts, seed lists, file paths, whatever text needs to ride along between runs.
The two inputs are all there is:
- stringvalue - the text to save. A single string; there's no batch handling here like the image node has, so it's one push per value.
- key - the stack's variable name, default
"default". Keep it meaningful -"prompt"instead of"default"- because the pop side has to match it exactly.
stackpath is optional and you can ignore it; ./ComfyUI/Stack/ lands in your ComfyUI install folder.
How it works
Under the hood it's about as simple as it gets: the node writes your string to a timestamped ._st file (that's the text extension the pack uses for strings) in ComfyUI/Stack/<key>/. The timestamped filename is what lets the pop node order them, newest first, like a proper LIFO stack. The node also marks itself changed every run so it always executes when the queue reaches it - important, because the pop node in the other workflow needs to see fresh data.
The files are plain UTF-8 text. You can open them in any editor and see exactly what's in the stack. That's the upside of a disk-backed approach: the state survives ComfyUI restarts, which in-memory-only solutions don't.
Install
Nothing special, same as every node in this pack:
cd ComfyUI/custom_nodes
git clone https://github.com/concarne000/ComfyUI-Stacker
then restart ComfyUI. Or use ComfyUI Manager and search "ComfyUI-Stacker". Zero model downloads, and the only listed dependency is pickle - Python's standard library - so there's no dependency hell to wade through.
Gotchas
- The key is case-sensitive and must match the pop node's key.
"Prompt"and"prompt"are two different stacks. - The stack path is relative to where ComfyUI launches from. Weird launch directory, weird stack location.
- Pushing is non-destructive, but popping is: StackPopString deletes the file after reading unless you use
Peekmode. If you want a reusable value, either push it fresh each run or pop withPeek.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | default | — |
| stringvalue | STRING | — | |
| stackpathopt | STRING | ./ComfyUI/Stack/ | — |
Outputs (0)
No outputs