Nodes/comfy-ovum/Set LocalStorage
ComfyUI Node

Set LocalStorage

Persist little strings across sessions, in your browser not your server

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Set LocalStorage
  • any_input
  • any_output
  • applied
  • prev_value
name
value
overwritetrue

Here's the honest version: Set LocalStorage is the browser-side cousin of the environment variable nodes in this pack. Where SetEnvVar writes to the ComfyUI process's environment (gone on restart), this one writes into your browser's localStorage - the same persistence mechanism ComfyUI itself uses to remember your canvas and settings. Write it once, and it's still there after you close the tab, restart ComfyUI, even reboot the machine. That's the entire value proposition, and it's real.

The catch, and the author is upfront about it in the code comments: the backend can't touch the browser. What actually happens is the node returns a UI message through ComfyUI's frontend channel, and the frontend extension performs the actual localStorage.setItem. So this works, but it's a browser-level feature, not a server-level one.

The inputs that matter

  • name - the localStorage key.
  • value - the string to store. Strings only - encode structures as JSON if you need them.
  • overwrite - defaults to true. Set it to false and an existing key is left untouched, turning this into a "write once" latch that survives restarts.

There's also the usual any_input passthrough (forwarded unchanged as any_output) so you can force execution order, plus applied (BOOLEAN) and prev_value (STRING) outputs reporting what happened.

Why you'd reach for it

State you want to survive a restart but don't want to keep typing: a default output directory you switch between, a "first run" flag, a counter that persists across sessions, a UI preference you want a workflow to respect. Paired with Get LocalStorage (same pack), you can write once in one workflow and have other workflows read the value days later - persistence across time, which the environment variables can't give you.

The honest counterpoint: if a value needs to be readable by the backend for real logic (not just coordinating the UI), the README says it plainly - use environment variables instead. localStorage is best for state that mostly lives in the browser anyway.

Installing it

It's part of comfy-ovum:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

Restart, or use ComfyUI Manager ("comfy-ovum"). No models, no extra dependencies beyond the pack's usual light set (numpy, pillow, requests, aiohttp).

Gotchas

Because the write happens in the browser, the node is effectively a no-op on the server - the "applied" result and previous value are reported from the frontend's side of the fence, so don't build backend logic that depends on prev_value being authoritative. Keys are shared across all your workflows, so prefix them. And a subtle one: localStorage is per-browser and per-origin, so if you access ComfyUI from a different browser or a different port, the storage is a different box.

Categoryovum

Inputs (4)

NameTypeDefaultDescription
nameSTRINGlocalStorage key name.
valueSTRINGString value to store.
overwriteBOOLEANtrueIf false, keep an existing value and do not change it.
any_inputopt*Optional passthrough input to enforce execution order; forwarded unchanged.

Outputs (3)

NameTypeDescription
any_output*
appliedBOOLEAN
prev_valueSTRING