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

AF - Load Prompt History

Time-travel through your saved prompts, newest first

By alFrame·Created 11 months ago·Updated 9 months ago· 4
AF - Load Prompt History
    • global_positive
    • global_negative
    • local_positive
    • local_negative
    • info
    directoryAF-PromptHistory
    filename
    timestamp_index0
    tip💡 TIP: Connect 'info' output to Show Text node to see this selection guide!

    AF - Load Prompt History is the reading half of the archive that AF - Save Prompt History writes. It loads a saved JSON archive and gives you back the four prompt strings - global_positive, global_negative, local_positive, local_negative - ready to wire into CLIP Text Encode. The twist is how you pick which entry: an index, where 0 is always the most recent save, 1 is the one before that, and so on. If you've ever wanted to rebuild a batch of images "with the prompt from two weeks ago," this is the node that makes it a two-second change instead of a archaeology dig through your history files.

    How it works

    On load it scans two places for .json files: first ComfyUI/output/{directory}/, then the pack's own folder. Files in your output folder win over same-named ones bundled with the pack. Every archive it finds becomes an entry in the filename dropdown (without the .json extension), and the node sorts each file's entries by timestamp, newest first - which is why index 0 is always the latest.

    Under the hood it caches the file list and the timestamp list per directory, so the dropdown doesn't rescan on every keystroke. That cache is also the source of its one real quirk: add a new JSON file while ComfyUI is running and it won't appear in the dropdown until you restart. The README's troubleshooting section says exactly that - restart ComfyUI to rebuild the cache.

    The inputs and outputs that matter

    • directory - folder to scan. This is the gotcha: the default here is AF-PromptHistory, but the Save node's default is Prompt-History. If you saved with the Save node's defaults and load with this one's, you'll get a "none" dropdown and confusion. Align them.
    • filename - dropdown of available archives. This starts as none until a directory is scanned.
    • timestamp_index - an integer from 0 to 999. 0 = newest. Out of range? No crash - you just get empty prompt strings and a warning in the info output.

    The five outputs are the four prompts plus info, and the info output is the one that makes the node usable. Wire it into a Show Text node and it prints the selected filename, how many timestamps exist, which entry is selected (including its timestamp), and the full content of all four prompts. The README calls this "critical" and it's not wrong - without it you're picking an index blind and hoping.

    What to actually do with it

    The obvious pattern is a comparison rig: two or three Load nodes at different indices, each feeding its own CLIP encode, all into one KSampler, so you can A/B the same prompt across models or seeds. Because each Load node is independent, you can point them at different files and different indices in the same workflow - the README's "Multi-File Workflow" pattern feeds one file's global positive, another's local positive, and a third's negative into a single encode. That's the more advanced version, but it shows the four outputs are just strings to be composed however you like.

    Install

    Part of the AF - Pack Prompt Nodes pack: no dependencies, no model downloads. ComfyUI Manager, search "AF - Pack Prompt Nodes", install, restart - or:

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

    Find it under AF - Nodes → AF - Prompt Pack. First run, connect info to a Show Text node before you do anything else - it turns the whole "which index am I on" experience from guesswork into a labeled readout.

    CategoryAF - Nodes/AF - Prompt Pack

    Inputs (4)

    NameTypeDefaultDescription
    directorySTRINGAF-PromptHistory
    filenameCOMBO1 options: none
    timestamp_indexINT00–999
    tipSTRING💡 TIP: Connect 'info' output to Show Text node to see this selection guide!

    Outputs (5)

    NameTypeDescription
    global_positiveSTRING
    global_negativeSTRING
    local_positiveSTRING
    local_negativeSTRING
    infoSTRING