ποΈ Memory Storage
Persistent Variables for ComfyUI, Warts Included
- Input
- Output
ComfyUI is stateless in the worst way: nodes forget everything the moment a queue finishes. Memory Storage (ποΈ Memory Storage, from ControlFlowUtils) is the pack's answer - a named variable that survives across executions, across prompts, across workflows, for as long as ComfyUI keeps running. Think of it as a global variable you can see and set anywhere in the graph.
The author's framing is right: "your creativity is the only limiting factor." Generate an image in one pass, store it, then have a later execution read it back, refine it, upscale it. Store a seed, a filename, a prompt fragment - anything that can live in Python memory can live in a Memory Storage.
How to use it
- Name (required) - the variable's identifier. It's case-sensitive and must be unique:
FileNameandfilenameare different variables. This is the single most common beginner error. - Input - the value to store. Wire anything in and it's cached and passed through to the output. Leave it unwired and the node instead reads the stored value and outputs that.
- Reset - clear the stored value. Convert to an input if you want to reset programmatically (e.g. via a condition).
- AcceptNulls - on, a None value (from this pack's Null Output, say) clears the storage; off (default), None values are ignored so a storage only ever holds valid data. That second mode is the trick for connecting a Memory Storage to a Universal Switch: unselected outputs don't wipe your stored value.
The single Output is either the value you just stored or the currently stored value - the same data your workflow reads.
Where it plugs in
The stored data isn't just for output wires. It's also accessible inside this pack's expression engines:
- Data Monitor with output type FORMULA, via
%VariableName%placeholders. - IfConditionSelector custom expressions, by variable name.
That's how you write a workflow that checks "did I already store a good result?" and branches on it. It's a poor man's workflow-level database, and honestly it's plenty.
The documented gotcha
The README's KNOWN ISSUES section is refreshingly direct: Memory Storages are a little TOO persistent. They survive even when you load a completely different workflow - the author explicitly says to clean them before switching workflows or restart ComfyUI if you hit issues. There's a helper: in Data Monitor's text you can use the __MEM__STORAGE__CLEAR__ directive to wipe all storages at once. If you see a workflow behaving as if it has leftover state, that's usually a stale Memory Storage, not a bug in your graph.
Worth repeating: the store lives in the running Python process. Restart ComfyUI and everything is gone. That's true for all of this pack's stateful nodes, and it's both the feature and the sharp edge.
Install
Memory Storage ships in VykosX/ControlFlowUtils:
# ComfyUI Manager β Install Custom Nodes β search "ControlFlowUtils"
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/VykosX/ControlFlowUtils
Restart, find it under πΊ VykosX-ControlFlowUtils, and start with the repo's "Math + Memory Storages" sample workflow - it's the fastest way to feel what a graph-wide variable actually unlocks.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| Name | STRING | Unique and case-sensitive identifier for the Memory Storage | |
| Inputopt | * | Value to set the Memory Storage to, and to passthrough | |
| Resetopt | BOOLEAN | If enabled, forcefully clears the Memory Storage | |
| AcceptNullsopt | BOOLEAN | Specifies whether the Memory Storage should ignore Null values |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Output | * | Data that will be forwarded to other nodes after caching |