Counter
Counter — count every run, and reset it when you actually mean it
- count
Counting things is surprisingly useful in a node graph. How many times has this workflow run? Which iteration am I on? What should this file be called so it doesn't overwrite the last one? This node answers all of those: every time the graph executes, it adds a number to an internal counter and hands you the running total as an INT. From the Utilitools pack, it's a stateful node - which is exactly the part people don't expect.
The inputs are increment (an INT from -999 to 999, default 1) and an optional reset (BOOLEAN, default false). One output: count. Increment can be negative, so it can count down too, though counting up is the usual job.
How the state actually works - read this
Here's the thing that surprises everyone the first time: the counter is stored on the node instance, and ComfyUI keeps node instances alive for the whole session. So the count doesn't reset when you run the workflow again - it keeps climbing across every single queue. Run it three times with increment 1 and you'll see 1, then 2, then 3, not 1, 1, 1.
The reset input is a boolean you toggle. When it's true, the counter zeroes out before adding the increment. Because you can wire a value into it, you can drive it from elsewhere - but in practice most people just flip it in the UI, run once to zero things out, and flip it back. The counter keeps its value until ComfyUI restarts, so if you shut down and come back tomorrow, it starts from 0 again.
Why does this matter? If you're using the counter to number output files, a persistent count is a feature - it means your filenames never collide even across separate runs. If you were expecting it to reset per queue, it's a bug and it'll silently keep climbing. Know which one you're on.
Where it fits
The honest uses: numbering saved images or batches so nothing gets overwritten (pair it with a Date Timestamp for unique filenames), tracking iterations in an experimental loop, or driving an index into a list of values (the pack's Create List + List Index combo). It's also genuinely handy for debugging - wire count into a text display and you can see how many times a branch actually executed.
Gotchas
The persistent state is the main one, plus the reset quirk: reset only clears when it's actually true at execution time, and it clears before the increment, so a reset run still outputs the increment value, not 0. If you want a run to output 0 you can set increment to 0 for that pass. And because there's no per-workflow reset, a shared workflow that uses a counter will behave differently on someone else's machine depending on how many times they've run it - worth knowing if you share graphs.
Installing it
Standard Utilitools install:
cd ComfyUI/custom_nodes
git clone https://github.com/aesethtics/ComfyUI-Utilitools
or search "Utilitools" in ComfyUI Manager and restart ComfyUI. It's under Utilitools → Workflow. No dependencies, no downloads - the whole pack is pure Python. A small pack with essentially no community footprint, but for "how many times has this run," this is the one box that remembers.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| increment | INT | 1-999–999 | — |
| resetopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| count | INT | — |