AZAll Chat History
Multi-turn chat that survives a queue reset
- config
- history_json
- formatted_history
The standard ComfyUI LLM setup is one shot: prompt in, answer out, then the context vanishes. AgentAZAll_ChatHistory fixes that by persisting a conversation as JSON on disk and letting you add to it turn by turn - so run 1 says "write a mystery opening," run 2 says "now introduce the detective," and the LLM still knows it wrote a mystery opening. True multi-turn chat, across queue runs and restarts.
The pattern is a loop, and the pack's demo makes it concrete: one ChatHistory node with user_message wired to your input, the LLM, then a second ChatHistory node with assistant_message wired to the LLM's response, both sharing the same session_name. The load-and-add happens in node one, the save-assistant in node two, and the whole thing rides the same JSON file.
How it works
Each execution, the node loads the existing history for the session, appends any new user_message and/or assistant_message you've fed it, trims the transcript down to max_turns (keeping the most recent), and writes it back to disk as <mailbox>/<agent>/<date>/notes/chat-history-<session>.txt - a JSON array of {"role": ..., "content": ...} objects. It emits both the raw JSON and a human-readable rendering.
That file is the conversation. Because it's a note in the mailbox tree, it inherits the whole pack's file-based persistence: plain text, inspectable, survives restarts.
The inputs that matter
config(required) - from AZAll Setup.session_name(required, defaultchat) - the conversation's identity. Two nodes that share a name share a history; different names, different threads. This is the knob you set once and keep consistent.user_message- new user turn to append.assistant_message- the LLM's reply to append (wire from the LLM node).max_turns(default 20, 1–100) - how many turns of context to keep; older turns get trimmed. Note the JSON is actually capped atmax_turns * 2entries (each turn is a user+assistant pair).clear_history- settrueto wipe the session and start fresh.
Two outputs: history_json (the raw transcript, what you'd feed a context window) and formatted_history (the [User]: ... / [Assistant]: ... rendering, better for human eyeballs and for prompt assembly).
Installing it
In cronos3k/comfyui-agentazall - Manager search "AgentAZAll", or:
cd ComfyUI/custom_nodes
git clone https://github.com/cronos3k/comfyui-agentazall.git
pip install "agentazall>=1.0.13"
# restart ComfyUI
No models, no keys - the persistence is just files.
Common issues
The two classic mistakes: forgetting that it's append-only per run (if you wire the same node to both the user input and the LLM output, you'll double-add the assistant turn), and letting max_turns bite you - with a long session, older context silently falls off the end, so don't expect it to remember run 1 of 50. History is also per-day on disk; the read side searches back for the latest copy, but a new date can surprise you if you expected one uninterrupted thread. If a session seems to have vanished, check mailbox_dir hasn't moved (the pack-wide cwd gotcha). When it works, it's genuinely the nicest way to get a real conversation out of ComfyUI.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| config | AZALL_CONFIG | — | |
| session_name | STRING | chat | — |
| user_messageopt | STRING | — | |
| assistant_messageopt | STRING | — | |
| max_turnsopt | INT | 201–100 | — |
| clear_historyopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| history_json | STRING | — |
| formatted_history | STRING | — |