Nodes/ComfyUI-GetWorkflowName/Get Workflow Name
ComfyUI Node

Get Workflow Name

Make your Save node name itself after the workflow you're running

By jKaarlehto·Created 10 months ago·Updated 10 months ago· 2
Get Workflow Name
    • filename.extension
    • delimiter_removed
    • filename/filename
    workflow_nameuntitled
    discard_after_this_delimiter_v
    also_remove_delimitertrue

    You know the pile. Fifty files named comfyui_00037.png because you loaded a workflow, hit Queue, and never touched the Save Image prefix. This node is the fix for that exact habit: Get Workflow Name grabs whatever you've named the workflow tab you have open, hands it to you as a string, and lets you wire it straight into Save Image's filename_prefix. Rename the tab, and your next render lands under a folder that matches it. No typing, no forgetting.

    It's pure plumbing in the best sense - the kind of node that touches no pixels and quietly de-spaghettifies your life, which is the layer that makes up the majority of every workflow you've ever loaded. And it answers a real, previously-unanswered ask: on r/comfyui, people were asking how to get the workflow's own filename into the graph for exactly this purpose - auto-naming saves after the .json they're working from - and the honest answer at the time was "I don't know of any node that does that."

    How it works

    There are two halves. The Python node itself is trivial: it takes a string, optionally trims it, and returns it three ways. The clever part lives in the frontend - the pack ships a web/js/filename.js extension that keeps the workflow_name widget synced to your active tab's filename. It reads the filename when the node is created, patches the workflow's rename handler so renames push through, and re-syncs on every promptQueued. So the widget isn't something you type; it's the real name of the .json you have open, live.

    The trim is where it earns its keep. The inputs you actually set:

    • workflow_name - auto-filled, but editable if you want to override.
    • discard_after_this_delimiter (default _v) - the cut point. The node finds the last occurrence and drops everything from there on, so portrait_v14 becomes portrait.
    • also_remove_delimiter (default on) - whether the delimiter itself gets cut too. Turn it off and portrait_v14portrait_v.

    Note the "last occurrence" bit: portrait_v14_v2 trims to portrait_v14, not portrait - the last _v wins. If the delimiter isn't in the name at all, no trimming happens and everything just echoes through.

    Three outputs, all strings:

    • filename.extension - the untouched name.
    • delimiter_removed - the trimmed name. This is the one you want for a Save Image prefix.
    • filename/filename - the trimmed name doubled with a slash, so you can feed a "subfolder/name" style prefix and get a per-workflow output folder for free.

    Installing it

    Through ComfyUI Manager, search "ComfyUI-GetWorkflowName" and install. Or, old-school:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jKaarlehto/ComfyUI-GetWorkflowName
    

    Then restart ComfyUI. That's the whole install: the pyproject.toml declares zero dependencies and the pack is OS-independent - no model downloads, no extra packages, no CUDA worries. One caveat: it's written against the newer comfy_api.latest native API, so it needs a reasonably recent ComfyUI. If the node doesn't show up after install, update ComfyUI itself, not the pack.

    Where people get burned

    The sync magic is frontend-only. If you're driving ComfyUI as a headless API, nothing auto-fills the widget - you'll be handing it whatever string is in the box. And if the node shows untitled, it usually means you added it before the workflow had a filename, or the JS extension didn't load; re-add the node or just queue once and it catches up. Honestly, the only real requirement is a naming habit: if every tab you work in is named "untitled," the node has nothing to grab. Name your workflows deliberately and this thing quietly deletes a whole category of annoying from your life.

    Categoryutils

    Inputs (3)

    NameTypeDefaultDescription
    workflow_nameSTRINGuntitled
    discard_after_this_delimiterSTRING_v
    also_remove_delimiterBOOLEANtrue

    Outputs (3)

    NameTypeDescription
    filename.extensionSTRING
    delimiter_removedSTRING
    filename/filenameSTRING