Nodes/ComfyAngel/ComfyAngel_FlowStateExtractor
ComfyUI Node

ComfyAngel_FlowStateExtractor

Unpacking what the flow wire actually carries

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_FlowStateExtractor
  • flow_state
  • index
  • accumulated1
  • accumulated2

The flow wire between Loop Start and Loop End looks like a signal cable, but it's really a suitcase. ComfyAngel packs loop state into it - which iteration you're on and what's been accumulated so far - and FlowStateExtractor is the node that unpacks it. It's another hidden internal helper, deprecated from the menu, and its entire job is plumbing the loop machinery.

What's inside the suitcase

When Loop Start fires, it doesn't just hand you the current item. It also packs a small dictionary into the flow output: the current index, plus the two accumulated values (acc1, acc2). Loop End needs those three numbers to do its job - knowing the index lets it compute "next iteration," and the accumulated values are the running total it keeps adding to. That's exactly what FlowStateExtractor pulls out: index as an INT, then accumulated1 and accumulated2 as generic values.

The mechanism is worth knowing because it explains a quirk: this node takes FLOW_CONTROL as a value, not as a link to the origin node. The flow_state input here is the actual packed dictionary, which is why you'd never connect a wire from Loop Start's flow output directly into it by hand - the loop's graph builder wires the state value through. If you ever see a loop that's spinning or losing accumulated data, this node is where to look.

Why it matters to you

Realistically you will never drag FlowStateExtractor onto a canvas. It exists so Loop End can do its expansion magic without re-running Loop Start to find out where it is. But understanding it pays off in two ways.

First, it's the reason the simple loop's results1/results2 survive across iterations at all - the accumulated values travel through the flow state, not through a visible wire, so they're easy to miss when you're debugging. Second, it explains a common confusion: the item output on Loop Start and the results outputs on Loop End are not the same data. Item is one element of the current pass; results are the whole history, carried in the state this node extracts.

Installing it

Same pack, same install:

cd ComfyUI/custom_nodes
git clone https://github.com/ThepExcel/ComfyAngel.git

Then restart ComfyUI, or grab "ComfyAngel" via ComfyUI Manager. Just Pillow as a dependency, no model files.

The short version: this node is the courier that carries loop progress invisibly between Start and End. You'll never summon it, but the day your loop forgets where it is, you'll know exactly which suitcase to blame.

CategoryComfyAngel/Loop/Internal

Inputs (1)

NameTypeDefaultDescription
flow_stateFLOW_CONTROL

Outputs (3)

NameTypeDescription
indexINT
accumulated1*
accumulated2*