Nodes/workflow-name/Workflow Name
ComfyUI Node

Workflow Name

Name Your Output Files After the Workflow, Automatically

By MichinariNukazawa·Created 6 months ago·Updated 6 months ago· 1
Workflow Name
    • workflow_name
    workflow_nameNO_WORKFLOW_NAME

    Workflow Name is a one-trick pony, and the trick is genuinely handy: it spits out the filename of the workflow you currently have open, as a plain STRING. You wire that string into SaveImage's filename_prefix and suddenly every image you render gets named after the workflow that made it. No more 00001_00001_.png wall of mystery files; you can tell at a glance which experiment produced which batch. It's a quality-of-life fix for the "I have 400 images and no idea what made them" problem, and for a node this small that's a fair deal.

    The name is a lie in one small way - it doesn't load anything. It only knows the current workflow, not a library of them. The workflow has to be saved on disk first, and it reports just the base filename, extension stripped. That's the whole feature, by design.

    How it works

    This one's interesting because almost all the work happens in the browser, not Python. The frontend script hooks app.queuePrompt - ComfyUI's internal function that fires when you hit Queue. Right before a run is queued it grabs the active workflow's filename from app.extensionManager.workflow.activeWorkflow.filename, POSTs it to a small /workflow_name/set endpoint on the server, gets a sanitized version back, and stuffs it into the node's widget. Then it calls the original queuePrompt and the run proceeds normally.

    The server side sanitizes the name before returning it: it keeps only the basename, strips .json, replaces Windows-forbidden characters (<>:"/\|?*) with underscores, and trims leading/trailing dots, spaces, and underscores. So a workflow saved as my cool: test.json becomes my_cool__test. If it ends up empty, you get the fallback.

    One honest caveat the author puts right in the README: this reads undocumented frontend internals. It works now, it may break on a future ComfyUI update. If a ComfyUI upgrade kills the node, that's the reason.

    The input and output that matter

    • Input workflow_name (STRING): Don't touch this. It's technically the required input, but it's really a widget the frontend overwrites on every queue. The default is NO_WORKFLOW_NAME, which is also what you get if the workflow has never been saved.
    • Output workflow_name (STRING): The one thing you care about. Wire it into SaveImagefilename_prefix.

    That's the entire surface. It's not an output node, it doesn't need a model, it has no optional inputs.

    Install

    Easiest via ComfyUI Manager - search for "Workflow Name" (the pack title) and install. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MichinariNukazawa/comfyui-workflow-name
    

    Then restart ComfyUI and hard-reload the browser (Ctrl+Shift+R) - the extension's JS lives in web/, so without a hard refresh the frontend won't pick it up. Dependencies are close to nothing: no model downloads, no torch, just the frontend package ComfyUI already ships (and it wants ComfyUI ≥ 0.15.1). It's CC0/public domain, so no licensing headaches either.

    Common issues

    • Output reads NO_WORKFLOW_NAME. The workflow was never saved. Press Ctrl+S once and queue again.
    • It shows an old name after reloading a workflow. The widget value gets baked into the workflow JSON, so reopening restores the last one - the queue hook overwrites it at runtime, so it's cosmetic.
    • Node stops working after a ComfyUI update. Expected, given the undocumented JS hook. Check the repo's issues; a hard refresh rules out a stale frontend first.

    It's a small fix for a small but real annoyance, and it's the sort of node you'll forget you installed until you sort your output folder and silently thank it.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    workflow_nameSTRINGNO_WORKFLOW_NAME

    Outputs (1)

    NameTypeDescription
    workflow_nameSTRING