Nodes/BrainDead Nodes/BD Clear Cache
ComfyUI Node

BD Clear Cache

The cleanup node

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Clear Cache
    • status
    pattern*
    confirm_clearfalse

    Every cache node in this pack hashes the seed into the filename, which means every seed you try leaves another copy in output/BrainDead_Cache/. Iterate hard for an afternoon - a dozen seeds on a mesh pipeline - and you've got a folder full of GLBs, PNGs and pickles you'll never touch again. BD Clear Cache is the broom: it deletes cached files by pattern, so you can sweep just what you don't need and keep the rest.

    It's deliberately boring and deliberately safe, and that's a feature. Two inputs, both widgets, no wiring required:

    • pattern - the filename pattern to match, like image_* or *mesh* or * for everything. The default is *, which matches every file in the cache folder.
    • confirm_clear - must be True to actually delete anything. Leave it False and the node just reports back what it would do. This is the guardrail that stops a careless queue from nuking your entire cache.

    The output is a single status string telling you what happened: how many files were deleted and how much space was freed ("Deleted 47 files (312.4 MB)" is the shape of it), or a refusal if confirm_clear is off.

    What it deletes - and what it won't

    The scope is one of the things worth knowing exactly, because it's a common fear. The source is explicit: BD Clear Cache only touches BrainDead_Cache/. It does not touch your main output/ folder, and it doesn't touch files saved by BD Save File or ComfyUI's built-in Save Image. The cache directory is the one place where every seed-hash variant piles up, and that's all this node sweeps. If you want to clear everything in it, pattern="*" with confirm_clear=True is the nuclear option - it works, but you'll pay the full regeneration cost on the next run.

    How you'll actually use it

    [BD Clear Cache]
      pattern: "trellis2_shape_*"
      confirm_clear: True
    

    Run it once with a targeted pattern, let it clear the stale hashed copies, then set confirm_clear back to False so a future accidental queue doesn't re-trigger it. Or keep it permanently wired into a "cleanup" corner of the workflow that you run deliberately when you finish a session. It's an output node, so it always runs when the queue touches it - another reason the confirm flag exists.

    Installing it

    Part of BizaNator/ComfyUI-BrainDead (BrainDeadGuild). ComfyUI Manager → search "BrainDead" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BizaNator/ComfyUI-BrainDead
    cd ComfyUI-BrainDead
    pip install -r requirements.txt
    

    Restart; it's under 🧠BrainDead/Cache.

    Gotchas

    The one real gotcha is the default: pattern="*". If you flip confirm_clear on and run, you're deleting everything in the cache folder, all cache types, all seeds - including the ones you carefully named as your good base generations. There's no recycle bin. If you keep good caches, get in the habit of matching a prefix (your cache_names, effectively) rather than *. And remember it's not a cache manager - there's no "keep newest N" logic; it's a file-matcher with a safety switch, which is exactly what it should be.

    Category🧠BrainDead/Cache

    Inputs (2)

    NameTypeDefaultDescription
    patternSTRING*File pattern to match (e.g., 'image_*' or '*')
    confirm_clearBOOLEANfalseMust be True to actually delete files

    Outputs (1)

    NameTypeDescription
    statusSTRING