Nodes/ComfyUI_MieNodes/Mie Loop Cleanup Text ๐Ÿ‘
ComfyUI Node

Mie Loop Cleanup Text ๐Ÿ‘

Clear scratch text files across a caption or text loop

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
Mie Loop Cleanup Text ๐Ÿ‘
  • loop_ctx
  • loop_ctx
  • cleaned

The text member of MieNodes' loop-cleanup family. When a loop writes .txt scratch files - draft captions, per-item logs, intermediate text on the way to a final result - MieLoopCleanupText removes them as the loop runs so they don't accumulate into a mess you have to clean by hand later.

It's part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under ๐Ÿ‘ Loop.

Why you'd reach for it

This one fits the pack's DNA especially well. MieNodes grew out of LoRA dataset tooling, where captions live in .txt files next to images, and a loop that processes a dataset is constantly writing text - a draft caption per image, a per-item note, a scratch file feeding the next step. Do that across a few hundred images and you've got a lot of little text files, and it's genuinely annoying to sort your final captions from the intermediate junk afterward.

Clearing the throwaway text each pass keeps the working directory honest, so when the loop finishes, what's left is the output you meant to keep rather than a haystack. It's the text-specific counterpart to the cleanup nodes for images, audio, and JSON.

How it works

Identical shape to its siblings. It joins the loop through the shared MIE_LOOP_CTX context - takes the context in, deletes the loop's intermediate text files, and passes the context back out so iteration proceeds. The cleaned boolean reports whether it actually removed anything this pass.

The inputs and outputs that matter

  • loop_ctx (MIE_LOOP_CTX, required) - the loop context that scopes the cleanup. Thread in, thread out.
  • loop_ctx (output) - pass onward to continue the loop.
  • cleaned (BOOLEAN, output) - whether any text was removed this pass.

Installing it

ComfyUI Manager โ†’ search ComfyUI-MieNodes โ†’ install โ†’ restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes

then restart. No model download. Nodes appear under ๐Ÿ‘ MieNodes.

Common issues & troubleshooting

Don't let it eat your captions. This is the sharp edge for a dataset workflow: your final captions are also .txt files, and you do not want them mistaken for scratch. Make sure the finished captions are written where the loop treats them as output, not as disposable intermediates, before this node runs. Deletion is permanent.

cleaned is false. Nothing to remove that pass - no intermediate text had been written yet. Not an error.

Loop-scoped only. It needs the MIE_LOOP_CTX from MieLoopBodyIn through MieLoopBodyOut; it isn't a general "delete .txt files" tool and won't touch text outside the loop's own scratch.

Test with a couple of iterations first. Because the failure mode here is deleting text you wanted, run a tiny loop and confirm the right files survive before turning it loose on a full dataset pass.

Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (1)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”

Outputs (2)

NameTypeDescription
loop_ctxMIE_LOOP_CTXโ€”
cleanedBOOLEANโ€”