Memory Storage
A scratchpad for strings that survives across runs
- output
ComfyUI is famously stateless - every run of a workflow starts fresh, and the only way to carry a value from one part of a graph to another is a wire. Memory Storage is the exception: a key-value scratchpad that lets one node write a string and another node read it back, even across separate queue runs. If you've ever wanted "remember that value I computed last run" without cramming everything into a global variable, this is the node.
How it works
It's a small key-value store keyed by string. Two modes, two scopes:
- mode -
setstores the value from the input field under a key;getlooks the key up and returns whatever was stored. Mode is a dropdown (getis the default), so the same node type does both jobs - you typically use two instances, one to set and one to get. - context -
workflowscopes the value to the current workflow (keyed by the workflow's root graph id), whileglobalmakes it visible across everything. Global is the "I want this everywhere" escape hatch. - persistent - the interesting one. When on, stored values are also written to disk under ComfyUI's user directory (
DadosNodes/memory_storage/), so they survive a ComfyUI restart. Off, and the value dies with the process.
The single output is a STRING: in get mode it's the retrieved value; in set mode it echoes back what you just stored (handy for chaining).
The inputs you actually set
- key - the name you're storing under. Empty key throws an error, so always set it.
- input - the value to store, only used in
setmode. It's optional and force-connectable, so it plays nice with any string output. - root_graph_id - normally leave it alone. It's what scopes
workflow-context values; the web UI fills it in.
Why you'd use it, and when you shouldn't
The genuinely useful pattern is caching expensive string results across runs - a fetched prompt list, a computed tag set, a wildcard expansion you don't want to re-roll every time. Set it once, get it everywhere, and optionally make it persistent so it survives restarts.
The honest caveat: it stores strings, nothing else. No images, no tensors, no numbers-as-numbers. And in-memory storage isn't shared between ComfyUI processes - if you restart the backend without persistent on, your values are gone. If you need to move data between two ComfyUI instances or across a machine reboot, persistent mode plus the disk files is the way; just know the files are plain JSON under your user directory, so don't treat them as a safe place for secrets.
Install
Same pack install as everything here: ComfyUI Manager → "Dados Nodes", or
cd ComfyUI/custom_nodes
git clone https://github.com/dadoirie/ComfyUI_Dados_Nodes.git
cd ComfyUI_Dados_Nodes
pip install -r requirements.txt
then restart. No models, no keys. It does lean on the pack's web routes (there's an API handler to clear storage per workflow), so keep ComfyUI reasonably current.
Common issues
The main foot-gun is get mode returning nothing because the set ran in a different scope - check that both nodes agree on workflow vs global, and that the key strings match exactly, down to trailing spaces. And because storage is per-node-instance state plus disk, a stale persistent value will happily come back after you thought you cleared it; the web route offers a delete operation, or just delete the JSON file under DadosNodes/memory_storage/.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| root_graph_id | STRING | — | |
| mode | COMBO | get | 2 options: set, get |
| context | COMBO | workflow | 2 options: workflow, global |
| persistent | BOOLEAN | false | — |
| key | STRING | — | |
| inputopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | STRING | — |