ComfyUI Node

Flow - Gate

The on/off switch for entire sections of your workflow

By krich-cto·Created 2 years ago·Updated 2 years ago· 1
Flow - Gate
    • gates
    outputSingle
    gate_1
    gate_2
    gate_3
    gate_4
    gate_5
    gate_6
    gate_7
    gate_8
    gate_9

    This is the node ComfyUI-Flow-Control is named after. FlowGate is the control that decides which whole section of your graph runs - not by muting a node or bypassing a wire, but by naming up to nine branches and then letting you pick which one is live. The dead branches don't run at all; the pack deletes them from the prompt before sampling. Think of it as a router for the top half of your workflow.

    It's a string node with a frontend attached. By itself it just concatenates a list of names into a comma-joined string. The interesting behavior happens when you wire its output into a condition node - FlowImageCondition, FlowLatentCondition or FlowClipCondition.

    How it works

    You get a text box per gate - gate_1 is required, gate_2 through gate_9 are optional, and the frontend auto-adds or removes boxes as you fill them in (up to nine). Give them names like main, portrait, landscape. Non-empty ones get joined into the single gates string output.

    The output dropdown sets the mode:

    • Single - one branch is active at a time. When you connect the gate to a condition node, the frontend adds a dropdown to that node listing your gate names; pick one and only its branch runs.
    • Multiple - branches are independent. You get a row of on/off toggles instead, one per gate, and any branch whose toggle is on runs.

    The frontend work is the clever bit: connecting a gate to a condition node renames that node's outputs to match your gate names and resizes the condition node to the right number of outputs. So you don't wire "gate_3" and wonder what it means - the output literally reads portrait.

    At execution, the pack's patched validation reads the gate string, works out which gates are open, and deletes every node downstream of closed gates (recursively, children included). Only open branches survive.

    The inputs that matter

    • output - Single or Multiple. Set this before wiring up branches.
    • gate_1 through gate_9 - the branch names. The first one is always there; the rest appear as you fill them.

    Output: gates, a comma-joined string. Wire it into a condition node's gates (or base, for FlowClipCondition) input.

    Install

    Part of ComfyUI-Flow-Control:

    cd ComfyUI/custom_nodes
    git clone https://github.com/krich-cto/ComfyUI-Flow-Control
    

    Restart ComfyUI, or Manager → "ComfyUI-Flow-Control". No models, no dependencies beyond the pack's usual requests/gguf imports.

    Gotchas

    Because the pruning deletes nodes rather than skipping them, the "off" branches vanish from the executed prompt - which is great for saving VRAM, but it means a wiring mistake silently empties half your graph instead of erroring. Empty gate boxes are ignored (that's how you remove a gate), and the mode swap from Single to Multiple re-lays-out the condition node's widgets, which can scramble saved widget values on old workflows. The core limit: gates only control branches behind a condition node, so the gate-to-condition wiring is mandatory, not optional. If you just want to mute a node, stock bypass does that; you reach for this when you want whole pipelines to swap.

    CategoryFlow/conditions

    Inputs (10)

    NameTypeDefaultDescription
    outputCOMBOSingle2 options: Single, Multiple
    gate_1STRING
    gate_2optSTRING
    gate_3optSTRING
    gate_4optSTRING
    gate_5optSTRING
    gate_6optSTRING
    gate_7optSTRING
    gate_8optSTRING
    gate_9optSTRING

    Outputs (1)

    NameTypeDescription
    gatesSTRING