A persistent chatbot that remembers the entire conversation across ComfyUI queue runs. History is saved to disk as JSON and reloaded automatically — true multi-turn sessions.
Load history → add user message → format with PromptTemplate → LLM responds → save response back to history.
ChatHistory stores the full conversation as a JSON file in the agent's data directory. Restart ComfyUI, re-queue — the conversation continues exactly where it left off.
Two ChatHistory nodes create a loop: the first loads history and adds the user message, the second appends the LLM response. Each queue run is one turn.
Configurable max_turns prevents the history from growing unbounded. Old messages are trimmed from the front, keeping the conversation within context limits.