Nodes/ComfyAngel/Workflow Metadata 🪽
ComfyUI Node

Workflow Metadata 🪽

Export the graph you just ran, as JSON, while it's still in memory

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
Workflow Metadata 🪽
    • prompt_json
    • workflow_json

    Workflow Metadata is the node that answers "what exactly did I just run?" with a machine-readable dump instead of a screenshot. It takes no inputs - it's a tap on the current execution - and outputs the workflow as two JSON strings. You've felt the need for this if you've ever finished a run, wanted to save the exact graph alongside the output, and realized your options were a PNG you'd have to re-open or a hand-typed text file.

    In the ComfyUI world, the graph is the project file: every saved image carries the workflow embedded in it as PNG text chunks. This node does the same thing SaveImage does, but hands the JSON to you as a live output instead of burying it in a file. It's genuinely useful for archiving a machine-readable copy next to your renders, for feeding the JSON to the pack's JSON Extract node to pull out specific values, or for debugging what the backend actually received.

    How it works

    ComfyUI injects two hidden values into every execution: PROMPT and EXTRA_PNGINFO. The prompt is the API-format graph - the flattened node list with resolved values, exactly what the backend runs. extra_pnginfo carries the UI's workflow chunk when you're running from the interface. The node dumps whichever are present, pretty-printed with two-space indentation, into prompt_json and workflow_json.

    That maps directly onto the two chunks SaveImage writes into a PNG. The prompt_json is the "execution format" and the workflow_json is the "editable UI graph" - the same distinction you hit when you drag an image back onto the canvas and get a graph back, versus opening a raw API prompt.

    Inputs and outputs

    No visible inputs at all. Two outputs:

    • prompt_json - the API/execution prompt as JSON (always populated).
    • workflow_json - the full UI workflow as JSON (only when running from the UI).

    Because it isn't marked as an output node, you'll want to wire these somewhere - a Save Text node, a JSON Extract, or an overlay - or the data just evaporates.

    Gotchas worth knowing

    The big one is the API/UI asymmetry, and it's the same asymmetry the image-metadata world runs into constantly: workflow_json only fills in when you run from the UI, because extra_pnginfo's workflow chunk only exists there. Drive ComfyUI as an API and you get prompt_json only. Also, don't expect prompt_json to match what you typed in the widgets - it's the resolved execution graph, with defaults filled in and values in API format, so differences from your UI view are normal, not a bug.

    Installing

    Install via ComfyUI Manager (search ComfyAngel) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ThepExcel/ComfyAngel
    

    Restart ComfyUI. Only dependency is Pillow - lightweight install, no models.

    CategoryComfyAngel/Utility

    Inputs (0)

    No inputs

    Outputs (2)

    NameTypeDescription
    prompt_jsonSTRING
    workflow_jsonSTRING