Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Global String Updater
ComfyUI Node

EmAySee Global String Updater

Save workflow state to disk — with a built-in append-only history

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Global String Updater
    • passthrough
    input_text
    pathO:/custom_nodes/storage
    file_nameiteration_state

    If you've ever wanted a ComfyUI workflow to remember something - "what was my last iteration count?", "what's the current story state?" - you've hit the stateless wall. This node is the writer half of the pack's file-based state system: it takes a string and saves it to a text file. Run it in one workflow, read it later from another with EmAySee_GlobalStringReader. And it does one thing the reader doesn't: it keeps an append-only log of every value you've written, so you get both the current state and the history.

    How it works

    Give it input_text, a path, and a file_name, and it writes the text to {path}/{file_name}.txt (overwriting - that's the "current state" file). Then it appends the same text plus a blank line to a second file, {path}/{file_name}-story.txt - the append-only history. It returns the input text unchanged as a passthrough output, so you can keep using the value downstream without the node breaking your wire. The directory is created if it doesn't exist, same as the reader.

    That history file is the genuinely nice touch: it's a run log for free. Every write is recorded in order, which means you can reconstruct how state evolved even after the current-state file has been overwritten dozens of times. For iteration counters, story prompts, or any "state that changes over a long batch," that append log is audit history you didn't have to build.

    Inputs and outputs

    • input_text (STRING, forced input) - the value to persist. Wire it from any text source.
    • path (STRING) - target directory. Default is O:/custom_nodes/storage, the author's own Windows path - change it.
    • file_name (STRING, default iteration_state) - base name; .txt is appended.

    Output: passthrough (STRING) - the input text, returned unchanged.

    Where it fits

    Pair it with EmAySee_GlobalStringReader for cross-workflow state, or use it solo as a cheap structured logger. The natural pairing: an iteration loop increments a value, writes it here, and a later stage reads it back to decide what to generate next. It's file-based, so it even survives a ComfyUI restart - memory-based globals don't.

    Install

    Part of ComfyUI_EmAySee_CustomNodes. ComfyUI Manager → search "EmAySee" → install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    

    No dependencies, no models. Restart and you'll see the pack's "SPECTRE v5.0" banner.

    Gotchas

    Same caveats as its sibling: change the default O:/ path or the node will try to create it (and can fail on non-Windows). No file locking, so concurrent writers can clobber each other - keep one writer per file. And the append-only history grows without bound; if you leave a long batch running for days, {file_name}-story.txt will get big. That's the price of the audit log; rotate it by changing file_name when it matters.

    CategoryEmAySee/Logic

    Inputs (3)

    NameTypeDefaultDescription
    input_textSTRING
    pathSTRINGO:/custom_nodes/storage
    file_nameSTRINGiteration_state

    Outputs (1)

    NameTypeDescription
    passthroughSTRING