ComfyUI Node

Reap

Harvest everything Sow collected, as one LIST

By Duanyll·Created 11 months ago·Updated 4 months ago· 2
Reap
  • signal
  • LIST
tagdefault

Reap is the payoff end of ComfyUI Functional's Sow/Reap pair. While Sow drops values into a tagged bucket during a loop, Reap sits at the end, returns everything that was collected as a single LIST, and empties the bucket. It's the cleanest way in this pack to turn a loop's scattered per-iteration outputs into one consumable list - the classic "collect results" step you'd otherwise have to hand-plumb.

It earns its place in the side-effects category because it does the thing ComfyUI's pure functional graph model is bad at: accumulating state across iterations. Map, Nest, and friends are nice and declarative, but when you need the side results of a run - intermediate scores, masks, debug images - a Reap at the tail is far less work than threading an accumulator through every call. The functional-sow-reap.json example workflow in the repo is exactly this.

Inputs:

  • signal - any value, used purely for execution ordering. Make sure the loop that feeds your Sows is done before the signal reaches Reap, or you'll harvest a partial bucket.
  • tag - string, default "default". This is the bucket name; it must match the tag you used on the Sow side. Get it wrong and Reap quietly returns an empty list.

Output: one LIST socket holding everything sown under that tag, in collection order.

Mechanically it's a couple of lines of Python: Reap reads the global per-tag storage, returns the list, then resets that tag to []. The pack's execution hook wipes all reap_storage at the start of every run, so stale values can't survive from a previous queue. Like its sibling, IS_CHANGED returns NaN - Reap runs fresh every time, and caching around side-effect nodes is switched off, which costs you some rerun speed.

Install

Same single pack as everything else here:

cd ComfyUI/custom_nodes && git clone https://github.com/Duanyll/comfyui_functional

then restart. Or ComfyUI Manager → search Duanyll/comfyui_functional. No models, no pip requirements. Remember Basic Data Handling if you want the resulting LIST to play nicely with other functional nodes.

Gotchas

  • Reap drains the bucket. Two Reaps on the same tag in one run - the second one comes back empty. Harvest once.
  • Tag typos look like bugs. Nothing crashes if Reap's tag doesn't match a Sow's; you just get an empty list and a confused afternoon. Name tags deliberately.
  • Ordering is on you. Reap collects whatever has been sown by the time the signal chain reaches it. If your loop hasn't finished, you get a partial harvest - that's not a Reap bug, that's a wiring bug.
Categoryduanyll/functional/side_effects

Inputs (2)

NameTypeDefaultDescription
signal*
tagSTRINGdefault

Outputs (1)

NameTypeDescription
LISTLIST