Nodes/ComfyUI AF - Pack-Prompt-Nodes/AF - Save Prompt History
ComfyUI Node

AF - Save Prompt History

Stop keeping your good prompts in a text file you'll never reopen

By alFrame·Created 11 months ago·Updated 9 months ago· 4
AF - Save Prompt History
    • global_positive
    • global_negative
    • local_positive
    • local_negative
    directoryPrompt-History
    filenamedefault
    projectdefault
    global_positive
    global_negative
    local_positive
    local_negative

    Every serious ComfyUI user has the same workflow-less habit: you finally nail a prompt after twenty attempts, screenshot it into a folder you'll never search, and move on. AF - Save Prompt History is the "stop doing that" node. You drop it into your prompt chain, and every time you run the workflow it appends the current prompts - up to four of them - to a JSON archive with a timestamp, so your good generations become recoverable history instead of one image you can't reconstruct. It's part of the AF - Pack Prompt Nodes suite, and it pairs naturally with its sibling, AF - Load Prompt History.

    How it works

    Each run of the node appends one entry to a JSON file: a timestamp, a project label, and the four prompt slots - global_positive, global_negative, local_positive, local_negative. "Global" and "local" are the pack's way of splitting a prompt into a broad base and a detail layer; you don't have to use all four slots, the empty ones just get stored as blank strings.

    Two behaviors worth knowing. First, it only saves when something actually changed: if the new prompts are identical to the last entry, it skips the write entirely (added in v1.0.4 specifically to stop the archive filling with duplicates on every rerun). Second, it cleans each prompt - trailing whitespace stripped, internal formatting preserved - so the file stays tidy without mangling your line breaks.

    Where the files land

    The save location depends on whether the directory already exists in your output folder:

    1. If ComfyUI/output/{directory}/ exists, that's where it writes.
    2. Otherwise it writes inside the pack's own folder at {pack_folder}/{directory}/.

    So on a fresh install, your first save creates the archive inside the pack directory; create an output/Prompt-History/ folder (or set directory to something that already exists there) and it switches to your working files. The file itself is pretty JSON, human-readable, exactly the format the Load node expects.

    The inputs that matter

    • directory - folder name, default Prompt-History.
    • filename - JSON file name, default default. Change this per project and you get one archive per project.
    • project - just a label stored in each entry for later inspection. It does not filter anything on load; the README is explicit about that. Mental note only.
    • The four prompt strings (global_positive, global_negative, local_positive, local_negative) - wire these from your text sources.

    The node also passes all four prompts straight through as outputs, so it can sit inline in your chain - LLM → Edit → this node → CLIP Text Encode - without breaking the flow.

    The gotcha

    The default directory here is Prompt-History, but the Load node's default is AF-PromptHistory. If you use both defaults and then wonder why Load finds nothing, that's why. Align the two directory values and it just works.

    Install

    No dependencies, no model files - the whole pack is plain Python plus a bit of front-end JS. ComfyUI Manager: search "AF - Pack Prompt Nodes" and install. Or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/alFrame/ComfyUI-AF-Pack-Prompt-Nodes.git
    

    Restart ComfyUI, and you'll find the node under AF - Nodes → AF - Prompt Pack. There's a bundled example workflow (AF-Save_and_Load_Prompt_History.json) that shows Save and Load wired together - worth a look the first time so you can see the file format before you start trusting it with real prompts.

    CategoryAF - Nodes/AF - Prompt Pack

    Inputs (7)

    NameTypeDefaultDescription
    directorySTRINGPrompt-History
    filenameSTRINGdefault
    projectSTRINGdefault
    global_positiveoptSTRING
    global_negativeoptSTRING
    local_positiveoptSTRING
    local_negativeoptSTRING

    Outputs (4)

    NameTypeDescription
    global_positiveSTRING
    global_negativeSTRING
    local_positiveSTRING
    local_negativeSTRING