Nodes/ComfyUI-LogicUtils/Counter Integer
ComfyUI Node

Counter Integer

A value that counts up every time you run

By aria1th·Created 3 years ago·Updated 7 months ago· 116
Counter Integer
    • INT
    start0
    resetfalse

    A running tally that ticks up each time the workflow executes. First run outputs your start value, next run one more, and so on - the node remembers where it was between executions. It's the ComfyUI equivalent of a counter variable, and it's handy anywhere you want a number that advances on its own without you touching a slider.

    The obvious uses: numbering outputs across a batch so filenames don't collide, stepping an index into a list of prompts one per run, or driving anything that should change by a fixed amount each execution. If you've ever wanted "just give me the next number" inside a graph, this is it.

    Yes, the class name is CounterInteger - the typo is baked into the node, so that's what you search for. It happens.

    How it works

    The node holds state on the server. Each time it runs it emits the current count and increments for next time. Because it's an output node, it executes whenever you queue the workflow even if nothing is wired to consume its value - which is what lets it keep counting reliably rather than getting skipped when its output looks unused.

    That server-side memory is the thing to understand: the count lives in the running ComfyUI process, not in the workflow file. Restart ComfyUI and it resets. It's also shared per-node-instance, so if you're relying on the sequence, keep it to one counter doing one job.

    The inputs that matter

    • start - the base value the count begins from. It's typed as a float in the node, but the output is a clean integer, so feed it a whole number and think of it as your starting count.
    • reset (optional, default false) - flip this true to send the count back to the start value. This is your "zero it out" switch for beginning a fresh sequence without restarting ComfyUI.

    The output is a single INT you wire into a filename builder, a list index, a seed offset, or wherever a stepping number is useful.

    The gotcha

    State that lives in the process is convenient and also easy to get surprised by. The counter advances on execution, so re-running the queue, autosaves, or a cached graph re-firing can move it in ways you didn't intend, and it silently resets on a ComfyUI restart. If you need a number that's stable and reproducible from the workflow alone, a counter isn't the right tool - use a fixed input or a seed. Use this when you specifically want a value that changes run to run.

    Installing ComfyUI-LogicUtils

    ComfyUI Manager: Install Custom Nodes → search "ComfyUI-LogicUtils" → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aria1th/ComfyUI-LogicUtils
    

    Restart ComfyUI. No dependencies.

    Worth knowing

    The pack is aria1th's (AngelBottomless) undocumented utility grab-bag. Remember two things about this node and you'll be fine: the state is in-process (so it resets on restart), and reset is how you deliberately start over. Everything else is just "the next number, please."

    CategoryLogic Gates

    Inputs (2)

    NameTypeDefaultDescription
    startFLOAT0-9223372036854776000–9223372036854776000
    resetoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    INTINT