Integer
LF Nodes' history trick
- ui_widget
- int
- int_list
An integer input is the most boring node in ComfyUI - until you've retyped your favorite seed for the tenth time and start wishing the thing had a memory. LF_Integer is the pack's answer: a plain integer widget with a history list, so every value you've used is one click away, plus an optional randomize mode that picks from your past values instead of a cold random draw.
You already have ComfyUI's built-in integer widget, so the pitch here is the extras. If you're tuning a pipeline by hand - steps, batches, CFG, whatever you keep bumping - the history saves you from re-typing and, more importantly, lets you flip back to a previous setting in one click when you've over-tuned. The ui_widget on this node is a KUL_HISTORY widget, which is the whole story: it's a value with a past.
How it works
Four settings control it. integer is the value itself. enable_history (default on) makes the node save each executed value and its date, feeding the history list. randomize (default off) picks a previously used value from that history - it can't invent numbers it's never seen, which is a nice constraint for keeping runs within your own search space. And seed controls that random pick so you can reproduce a chosen sequence.
The output is what you'd expect:
int- the current value, wired into anything that takes an INT.int_list- the same value as a single-element list, for nodes that iterate over a batch of integers.
The interesting part for a beginner: because the node remembers values across runs, it's also a lightweight form of state. Want to run a batch where each run steps through resolutions or step counts? Type them once, hit run, and randomize cycles through what you actually used before - reproducible because the seed is there.
Installing it
This node is part of LF Nodes, so installing the pack is the whole install:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf
Restart ComfyUI afterward. Or search for LF Nodes in ComfyUI Manager and click install. Dependencies are minimal (numpy, Pillow, opencv-python, requests, torch), and nothing gets downloaded at runtime.
Gotchas
The history is the feature and the trap. If you enable randomize but your history list is empty - first run, nothing executed yet - there's nothing to pick from, so the value stays put. Run the workflow once with the value you care about, then let randomize take over.
Also remember the legacy status: comfyui-lf is frozen (Feb 2025) and the author now maintains lucafoscili/lf-nodes. The frozen version works fine - that's why it was frozen - but the history widget here is old frontend code, and the new repo is where the refreshed widgets live.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| integer | INT | 0 | Integer value. |
| enable_history | BOOLEAN | true | Enables history, saving the execution value and date of the widget. |
| randomize | BOOLEAN | false | Randomly selects a previously used value (must be present in the history list). |
| seed | INT | 42 | Seed to control the randomness when 'randomize' is active. |
| ui_widgetopt | KUL_HISTORY | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| int_list | INT | — |