BD Save Context
Kill the concat-string filename spaghetti
- context_id
- status
Every serious ComfyUI workflow eventually turns into a pile of filename builders - a text concat node here, a string join there, and suddenly your save nodes are fed by something that looks like a Perl one-liner. BD Save Context is the BrainDead pack's answer: define the path template and variables once, and every downstream save node resolves its own filename from it. It's the rare plumbing node that actually deletes nodes from your graph.
What it is
A context-definition node. You give it a context_id (a name), a template, and a set of variables, and it registers that context globally. Any BrainDead save node - BD Save File, BD Bulk Save, BD Save Batch, BD Save MP Face Data - can then look it up by id and resolve a full path without you typing the path anywhere else.
How it works
The template is a %varname% pattern:
%project%/%character%/%subfolder%/%character%_%name%_v%version%%suffix%
Each save node that uses the context just supplies its suffix (e.g. _albedo, _skin_mask, _head) and the context fills in the rest. So one context named default with project=biloxi, character=letti, name=topwear, version=03 turns _albedo into biloxi/letti/letti_topwear_v03_albedo_001.png automatically. Add a save point later by wiring the same context_id - no string surgery.
Details worth knowing:
- Empty
%vars%collapse cleanly -a/%b%/cwithb=""becomesa/c. Undefined vars stay as literal%var%text, which is deliberate: it surfaces typos instead of silently writing weird filenames. Flipstricton if you'd rather it hard-error. base_dirsets the root; empty means ComfyUI's output folder. You can also use an alias from theBD_SAVE_ALIASESenv var, with optional lockdown viaBD_SAVE_ALLOWED_ROOTS.auto_increment(default on) appends_NNNso you don't overwrite - padding set byincrement_padding.- Per-save
custom_vars(key=value lines) layer on top of the context's owncustom_vars, and this node'scustom_varsare available to every save under it.
The inputs
context_id (make it meaningful if you run several - character_v1 vs mannequin_v1), template, and the convenience vars character, name, version, project, subfolder, tag. Outputs: context_id (so you can wire it explicitly) and status.
The gotcha
Auto-pick. If context_id is empty on a downstream save node and exactly one context is registered, the save node uses it silently. That's convenient and it's also how you save a file to a surprising location when you forgot you registered a context earlier in the graph. With multiple contexts registered, an empty id means the save node falls back to legacy behavior - so if saves stop following your template, check whether a second context got registered.
Installing it
ComfyUI Manager: search "BrainDead" → install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt
Restart, find it under 🧠BrainDead/Cache. The canonical use from the README: one Save Context + a BD Bulk Save with labels=albedo,normal,roughness,metallic,ao → seven PBR maps land in the right folders in one run, and the whole graph stays readable. That's the payoff - you're not saving files, you're getting your workflow back.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| context_id | STRING | default | Identifier for this save context. Save nodes match by this id. Use distinct ids if you have multiple parallel contexts (e.g. 'character_v1' and 'mannequin_v1'). |
| template | STRING | %project%/%character%/%subfolder%/%character%_%name%_v%version%%suffix% | Base template with %varname% placeholders. The save node's `suffix` input is appended to this template before resolution. Use %suffix% in the template to control suffix placement (defaults to end if omitted). Empty %vars% are cleaned up — `//` collapses to `/`. |
| characteropt | STRING | — | |
| nameopt | STRING | — | |
| versionopt | STRING | 01 | — |
| projectopt | STRING | — | |
| base_diropt | STRING | Root directory for saves. Empty = ComfyUI output dir (default, backward-compatible). Otherwise an absolute path the template resolves under — works cross-platform, e.g. 'D:/MyImages' or '/mnt/data/assets'. You can also use a short alias defined via the BD_SAVE_ALIASES env var. Optional lockdown via BD_SAVE_ALLOWED_ROOTS. | |
| subfolderopt | STRING | Sub-organization within the output folder — e.g. a category or stage name. Empty cleans up to nothing in the path. | |
| tagopt | STRING | Generic tag — typical use: part name like 'face', 'topwear', 'arm-l'. | |
| custom_varsopt | STRING | Additional variables, one per line as key=value. e.g. resolution=4096, layer=topwear. | |
| auto_incrementopt | BOOLEAN | true | Append _NNN to avoid overwriting. Applies to ALL save nodes using this context. |
| increment_paddingopt | INT | 30–10 | — |
| strictopt | BOOLEAN | false | If True, save nodes raise an error when the template contains undefined %variables% at save time. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| context_id | STRING | — |
| status | STRING | — |