ComfyUI Node

String

A string node that remembers what you typed before

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
String
  • ui_widget
  • string
  • string_list
string
enable_historytrue
randomizefalse
seed42

A plain string input is the most boring node in ComfyUI - you type, it passes through. LF_String is the LF Nodes version of that, and the difference is enable_history: on by default, it remembers every value you've used, along with when you used it. So when you're tweaking a prompt, a negative prompt, or a filename prefix through twenty iterations, the node keeps the full run of what you tried. That turns "what did I run before I broke it?" from a panic into a dropdown.

The core is still just a multiline string input with a string output (plus a string_list variant if you need the value as a list - say, a single-element list for a node that expects list input). What the history adds is a record: every execution stamps the current value and date into the widget's history list, and because the frontend renders that history widget, you can go back and grab a previous value without retyping it. It's the same idea as ComfyUI's built-in seed history, applied to arbitrary text, and it's quietly one of the most-used conveniences in the pack.

Then there's randomize. Flip it on and instead of using your typed value, the node randomly selects one of the previously used values from its history, controlled by seed for reproducibility. This is a different mechanic from a generic "random string" node - it can only pick from values that already exist in the history list, which the tooltip is careful to spell out. So it's less "surprise me" and more "cycle through the prompts I've already vetted." If you've been collecting a library of good prompts across sessions, this lets you batch-test them randomly with a fixed seed so the selection is repeatable. The catch is right there in the mechanic: if the history is empty, randomization has nothing to pick - first build up a history by running with it off.

Where this earns its place in a workflow: any string that you iterate on and might want to revisit. Prompts are the obvious one - LF Nodes' history-for-primitives was a headline feature when the author announced the pack on r/comfyui - but it works just as well for paths, tags, and negative prompts. The pattern to steal: keep your "candidate" strings in an LF_String with history, and when you finally get one you like, you know it's still in the list.

Install is the pack standard: ComfyUI Manager → "LF Nodes", or git clone https://github.com/lucafoscili/comfyui-lf into custom_nodes, then restart. No models, no dependencies. And the note that applies everywhere in this pack: comfyui-lf is frozen in legacy mode (fully functional), with active development in lucafoscili/lf-nodes.

Category✨ LF Nodes/Primitives

Inputs (5)

NameTypeDefaultDescription
stringSTRINGString value.
enable_historyBOOLEANtrueEnables history, saving the execution value and date of the widget.
randomizeBOOLEANfalseRandomly selects a previously used value (must be present in the history list).
seedINT42Seed to control the randomness when 'randomize' is active.
ui_widgetoptKUL_HISTORY[object Object]

Outputs (2)

NameTypeDescription
stringSTRING
string_listSTRING