Nodes/ComfyUI-ChomfyNodes/Chomfy Universal Counter
ComfyUI Node

Chomfy Universal Counter

A counter that actually remembers between runs

By chchchadzilla·Created 11 months ago·Updated 4 months ago· 1
Chomfy Universal Counter
    • int_out
    • float_out
    • str_out
    mode
    start_value0
    step_size1
    modulo_limit0
    control_seed0

    Some workflows just need a number that moves. A timelapse where every frame needs a distinct filename, an animation loop that flips a switch after N frames, a batch that should change behavior partway through - this is the node for all of it. Chomfy Universal Counter remembers its value between runs, bumps it the way you ask, and hands you the result as an int, a float, and a string all at once so you can plug it into whatever needs it.

    It's a small utility, and it doesn't pretend otherwise. But if you've ever hacked a counter together from math and string nodes and watched it reset every time you hit Queue, you'll appreciate why someone bothered.

    How it works

    The trick is that it holds its state in memory keyed to the node's settings. ComfyUI normally re-runs a node only when its inputs change; this one cheats by reporting "something changed" on every execution, so it always runs and always advances. The current value lives in a dictionary inside the pack, keyed by control_seed + start_value + step_size.

    The modes are what you'd expect:

    • Increment - adds step_size each run.
    • Decrement - subtracts it.
    • Random Step - adds a random number between -step_size and +step_size. Great for jittering things without re-rolling a full seed.

    Set modulo_limit and it wraps back to 0 when it hits the ceiling - the tooltip says it plainly: "Reset to 0 after reaching this number (0 = disabled)". That's the loop switch.

    The inputs that matter

    Five inputs, and the two that do the real work are mode and step_size. start_value sets where counting begins, modulo_limit caps it, and control_seed is the counter's identity - change it and you get a separate, independent counter, which is how you run several at once in one workflow.

    Three outputs - int_out, float_out, str_out - all carrying the same number in different types, so you can feed a filename node, a math node, or a text node without converting. The int version is what most people actually wire up, typically into a filename prefix so each frame gets a new number.

    Installing it

    Same pack as the rest of Chomfy. ComfyUI Manager → search ComfyUI-ChomfyNodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chchchadzilla/ComfyUI-ChomfyNodes.git
    

    Restart. It sits under ChomfyNodes/Utils. No extra dependencies, no model files.

    Where people get burned

    Two things to know before you build a timelapse around it. First, the memory is in-memory only: restart ComfyUI and every counter snaps back to start_value. It's session persistence, not disk persistence - fine for a batch, not fine as a permanent database.

    Second, the identity key includes step_size and start_value. Change either and you haven't modified the counter, you've created a new one starting fresh. If you tweak the step mid-batch and expect it to continue where it was, it won't.

    One more honesty note: the README teases "zero padding" (that 0001-style formatting for file sorting), but the shipped node has no such widget - str_out is the raw number as text. Want padded filenames? Feed int_out into a text-format node and pad there. The counter counts; formatting is on you.

    CategoryChomfyNodes/Utils

    Inputs (5)

    NameTypeDefaultDescription
    modeCOMBO3 options: Increment, Decrement, Random Step
    start_valueINT0-99999999–99999999
    step_sizeINT11–10000
    modulo_limitINT00–99999999Reset to 0 after reaching this number (0 = disabled)
    control_seedINT00–18446744073709550000

    Outputs (3)

    NameTypeDescription
    int_outINT
    float_outFLOAT
    str_outSTRING