h4 - Traffic Cop (Splitter)
The h4 splitter that treats the first run differently
- any_input
- Run_Once_(Start)
- Loop_(Continue)
H4_TrafficCop is the h4_Live loop system's splitter: it looks at the shared run counter and routes your data out one of two ports - one meant for the first run, one for the loop runs after it. The pitch is "run things differently the first time vs the next times," and it's the founding concept of the whole pack. The README even says this node is where it all started: "This started as a simple switch node. Then we blinked. Now it's an ecosystem."
It's also, honestly, the legacy member of the family. The node's own description labels it a "Legacy Node" and tells you to consider the newer H4_TrafficRouter for more options. You can still build working loops with it, but know what you're getting.
How it works
Like every h4 traffic node, it reads (and increments) one global in-memory loop counter. Each time the workflow runs, the counter ticks up - unless restart_on_true is ON, in which case it resets to zero first. Then it routes:
- Run 0 (first run): data goes to the Run_Once_(Start) output.
- Run 1+ (loops): data goes to the Loop_(Continue) output.
The catch, and it's right there in the node description, is Safe Mode: "I will never output 'Nothing'. If a path is inactive, I send the data anyway to prevent your workflow from crashing." So both ports are actually fed every run. The design intent is that you build the "first pass" branch off one port and the "refine" branch off the other, and whichever is "active" for the current run is the one doing meaningful work. In practice, because Safe Mode passes data down both pipes, downstream logic (usually a merge node) has to do the real selection. That's why the pack nudges you toward the Router, which picks a single output instead of hedging.
The inputs that matter
- any_input (
*) - the thing you're routing. Works with anything: images, latents, models, text. It's required; the node raises an error if it gets nothing. - restart_on_true (boolean, default OFF) - OFF means the counter keeps incrementing (looping). Flip it ON to reset to run 0.
Outputs: Run_Once_(Start) (*) and Loop_(Continue) (*).
Installing h4_Live
One install gets the whole pack. ComfyUI Manager: search h4_Live, install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/m3rr/h4_Live
Restart. No model downloads, no pip requirements beyond ComfyUI's own stack.
Common issues
- It's the legacy option. If you're starting fresh, use H4_TrafficRouter. The Cop's safe-mode-everywhere behavior makes the actual branch selection ambiguous, and the Router's lazy evaluation only pulls the input it needs for the current run, which is cleaner.
- One shared counter. Every h4 traffic node in the graph increments the same counter. Two loops in one workflow interfere with each other - keep it to one loop, or be very deliberate about resets.
- Safe Mode means both outputs fire. If your "start" branch and "loop" branch both run every time, that's the design, not a bug - but it can double your compute if you aren't expecting it. It's exactly why the Router exists.
- Order matters. The counter increments when the node runs, so make sure the Cop actually executes before the branch you expect to react to it - use the State Monitor to verify you're on the run you think you are.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| any_input | * | Connect the item you want to control. It can be anything (Image, Model, Text, etc). | |
| restart_on_true | BOOLEAN | false | Turn this ON to start continuously from the beginning. Turn it OFF to allow looping. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Run_Once_(Start) | * | — |
| Loop_(Continue) | * | — |