Nodes/ComfyUI_MieNodes/Mie Loop State Get Bool ๐Ÿ‘
ComfyUI Node

Mie Loop State Get Bool ๐Ÿ‘

Reading a flag back out of a ComfyUI loop

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
Mie Loop State Get Bool ๐Ÿ‘
  • loop_ctx
  • BOOLEAN
โ—„keyfeedback_boolโ–บ
โ—„default_valuefalseโ–บ

If you've built a for-loop in ComfyUI, you've hit this wall: every lap of the loop re-runs the same subgraph from a clean slate. Nothing a node computed on iteration 3 is naturally still lying around on iteration 4. If you want a loop that actually remembers something - a running score, a "did this pass?" flag, an accumulated image - you need somewhere to stash it between laps. That's the entire job of the Loop State family in MieNodes, and Get Bool is the read half for boolean flags specifically.

How it works. The pack carries loop state around as a custom object type, MIE_LOOP_CTX - basically a little dictionary that gets passed into a loop iteration and back out again, updated. Get Bool takes that context plus a key string and hands you back whichever boolean is stored under that key. If nothing's been written there yet - first lap of the loop, or a typo in the key - you get default_value instead of an error, so the graph doesn't just fall over on iteration one.

The default key name, feedback_bool, is a giveaway for what this was built for: a self-critique or QC loop. Generate something, run a check against it (an LLM judge, a similarity score threshold, a manual gate), write the pass/fail into loop state as a bool, and read it back on the next pass to decide whether to keep going or bail out.

What you actually set.

  • loop_ctx (required) - the state object from wherever your loop is currently at. This has to come from another Loop-category node in this same pack; ComfyUI's typed sockets won't let you fake it with a generic string or dict.
  • key (default feedback_bool) - rename it to something you'll recognize later if you're tracking more than one flag.
  • default_value (default false) - what you get before anything's written, or if the key doesn't match.

The single output is a plain BOOLEAN, which wires straight into whatever expects one - a loop's exit condition, a conditional gate, another node's toggle input.

Installing it. Search the ComfyUI Manager for ComfyUI_MieNodes (that's the pack's title in the registry, distinct from the class names on individual nodes) and install from there, or do it by hand: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-MieNodes, then restart ComfyUI. No extra models or heavy dependencies for this one - it's a pure Python bookkeeping node.

Where people get stuck. Worth saying up front: the pack's own README doesn't document the Loop category at all - no node list, no example workflow, nothing. Everything below is read straight off the node's schema plus how ComfyUI for-loops generally have to work, not confirmed pack documentation, so treat it as a solid starting guess rather than gospel.

  • Always getting default_value back. Either this is genuinely the first time anything's written to that key (normal on lap one, before a matching Set node has run), or the key string doesn't match character-for-character what the Set node used. These are free-text fields, so a stray space or a capital letter breaks the match silently - you don't get an error, you just get the default forever.
  • Type error wiring loop_ctx. You're trying to feed it something that isn't a MIE_LOOP_CTX. That type is produced by other nodes in this pack's Loop category (a for-loop start node and the various Set nodes), not by anything generic - check what's actually upstream of the socket.
  • Nothing updates across iterations at all. Make sure the loop_ctx you're reading from is the one flowing forward through the loop, not a stale copy pulled from before the loop started. If your graph re-wires loop_ctx from the loop's initial state instead of its running state, every Get node will look frozen on lap one's values.
Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (3)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”
keySTRINGfeedback_boolโ€”
default_valueBOOLEANfalseโ€”

Outputs (1)

NameTypeDescription
BOOLEANBOOLEANโ€”