Nodes/Workflow2Filename/Workflow2Filename
ComfyUI Node

Workflow2Filename

Stop guessing which workflow made ComfyUI_00047_.png

By silno·Created 19 days ago·Updated 19 days ago· 1
Workflow2Filename
    • filename
    ◄filenameUnsavedWorkflow►
    ◄suffix►
    ◄use_workflow_nametrue►
    ◄fallback_prefix►

    Open your output/ folder after a weekend of tinkering and you get ComfyUI_00184_.png through ComfyUI_00251_.png. That's it. No clue which of them came from the Flux upscale test and which came from the SDXL portrait chain. You sort by date, you squint, you open a few in an image viewer hoping the embedded workflow jogs your memory.

    Workflow2Filename fixes exactly that one thing. It reads the name of the .json workflow you currently have open and spits it out as a string you wire into filename_prefix. Save SummerCat.json, and your next render lands as SummerCat_00001_.png. That's the whole pitch, and it's a good one.

    How the name actually gets there

    Here's the bit worth understanding, because it explains the quirks. ComfyUI's backend never sees your workflow's filename. The server receives a node graph, and workflow files don't store their own names, so nothing in the payload says "SummerCat". The pack solves this with a bundled frontend extension (js/workflow_filename.js) that digs the name out of the frontend's browser storage - the Comfy.Workflow.ActivePath / LastActivePath / draft-index keys the current Vue frontend uses, with legacy keys and document.title as fallbacks - then hands it over two ways at once: writing it into the node's filename widget, and injecting it into extra_pnginfo.workflow. The Python side tries both before giving up.

    That layering is why the node is survivable rather than fragile: if one path breaks the other usually carries it, and if both fail you get an UnsavedWorkflow tag instead of a crashed graph. It also means you're trusting a JS extension that reads frontend internals - the same category of code ComfyUI's Nodes 2.0 rewrite broke for other packs (comfyui-ecosystem.md). Worst case is cosmetic, not a dead graph.

    The four widgets

    The mandatory ones you actually touch:

    • suffix - appended after the workflow name. Empty means the name alone. This is where a version tag (v2) or a date token goes.
    • use_workflow_name - the master switch, ON by default. Flip it OFF and the node ignores the workflow name entirely and outputs fallback_prefix instead; suffix is not applied in that mode.
    • fallback_prefix - what you get with the switch off. Leave it empty and the node emits an empty string, which conveniently hands naming back to the save node's own default.

    filename looks editable and isn't. It's auto-filled at queue time and anything you type gets overwritten.

    One output, filename (STRING). Wire it into the filename_prefix of Save Image, SaveVideo, or VHS_VideoCombine - the counter still comes from the save node, so names increment and nothing gets overwritten.

    Suffixes, folders, and date tokens

    %date:yyyyMMdd% in suffix gives you SummerCat_20261005. The node expands that token itself - the author's fix for a real bug where a raw %date:…% landed verbatim on disk as part of the filename. Worth knowing: modern core Save Image also documents %date: and %NodeName.widget% tokens in its own tooltip, so a date alone isn't a reason to install this. The workflow name is the part core genuinely cannot know.

    A folder chain at the start of suffix becomes a real subfolder, created on first render:

    suffix: new/%date:yyyy-MM-dd_hhmm%
    → output/new/SummerCat_2026-10-05_1042_00001_.png
    

    Get the order right: the folder goes first (new/%date:…%), never after, or you'll get SummerCat_2026-10-05_new/. Double-clicking the field pops a menu of the four supported tokens - hh is 24-hour, mm is minutes and MM is the month, and a typo like %date:zz% stays visible instead of silently turning into gibberish. The root folder is still the save node's (output/, or output/video/ for VHS), so don't name your folder video.

    Installing it

    ComfyUI Manager: search Workflow2Filename, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silno/ComfyUI-Workflow2Filename
    

    No models, no pip dependencies - stdlib only, and the whole thing is one small node class plus a JS file that's served via WEB_DIRECTORY. Privacy-wise it's clean: no network calls, no telemetry, and the only file it writes is a local workflow_names.json.

    Where people get burned

    Everything says UnsavedWorkflow. Two causes. The obvious one: you never saved the canvas to a file - the node can't read a name that doesn't exist. The other is the extension not loading, usually a stale cached frontend, so hard-refresh with Ctrl+F5 after installing or updating.

    A saved workflow still gets tagged _UnsavedWorkflow. That marker means the name was resolved from a draft or "last active" path rather than a clean one - i.e. you have unsaved edits. Accurate, just surprising the first time.

    Remembered names come back only sometimes. The node fingerprints each graph (node types plus a hashed copy of their widget values) and reuses a remembered name only when the graph is ≥75% similar by Jaccard overlap, which is what stops two workflows inheriting each other's names. Delete workflow_names.json beside the node to reset it - Manager updates can take that file with them.

    Path length. Nested folders plus a 60-character workflow name is how you hit Windows' ~260-character ceiling. Names get clamped at 80 characters for this reason; keep the folder chain short.

    Confusing node identity. The display name is Workflow2Filename, but the internal type key is deliberately still WorkflowFilename, for compatibility with graphs saved before the rename. Grep a workflow JSON and you'll see WorkflowFilename - that's expected, don't "fix" it.

    One calibration note from image-io-metadata.md: filenames are cosmetic, and reproducibility lives in the PNG's embedded workflow chunk - so this won't save you from anything you'd otherwise lose. It saves you from sorting 400 identically-named files by hand. Boring, daily, real: plumbing that earns its slot (comfyui-node-plumbing.md).

    Categoryutils/io

    Inputs (4)

    NameTypeDefaultDescription
    filenameSTRINGUnsavedWorkflow—
    suffixSTRING—
    use_workflow_nameBOOLEANtrue—
    fallback_prefixSTRING—

    Outputs (1)

    NameTypeDescription
    filenameSTRINGWire this into the filename_prefix input of any save node (e.g. VHS_VideoCombine, Save Image). Output: ON -> <workflow name> (+ _suffix) | OFF -> fallback_prefix. Unsaved canvas -> the name is tagged with _UnsavedWorkflow. A sub-directory typed in the suffix or fallback_prefix (e.g. "video/ComfyUI_%date:yyyyMMdd%") is kept and moved in front, so the save node writes into output\video\ ... Date tokens (%date:yyyyMMdd%) are expanded HERE by this node - the save nodes only know %year%/.../%second%, never %date:...%.