Nodes/ComfyUI-ZMongo/10 Save Prompt Provenance Ledger
ComfyUI Node

10 Save Prompt Provenance Ledger

The audit trail for your prompts

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
10 Save Prompt Provenance Ledger
  • text_agent_config
  • json
  • ledger_document_id
  • success
  • refresh
original_prompt
final_prompt
negative_prompt
context_pack
image_document_id
workflow_id
notes
extra_json{}
refresh_token

The Text Agents family has a few nodes that do things with an LLM, and a few that just keep receipts. Save Prompt Provenance Ledger is a receipt-keeper. You give it the original prompt, the final prompt that actually went into generation, and optional context - and it writes an immutable-style record to your ledger collection linking the two, along with any image document ID, workflow ID, and notes you care to attach.

No Gemini call. No scoring. It's the "what did we start with, what did we end with, and what produced this image" node - the audit trail that makes the rest of the Text Agents workflow defensible. If you're iterating with Prompt Critic and Prompt Evolver, this is how you remember which evolved prompt actually won, rather than relying on "I think it was the fourth one."

How it works

The node builds a record with run_id, original_prompt, final_prompt, negative_prompt, context_pack, image_document_id, workflow_id, notes, and any extra_json you supply, stamps it with a timestamp and record_type: prompt_provenance, and writes it into the ledger collection from your text agent config (default text_agent_ledger), tagged with your project_name.

The image_document_id is the interesting bit for provenance: if you saved the generated image through ZMongo's image nodes, you can link the ledger entry to the exact output document. That gives you a chain of prompt → image you can actually query later.

Inputs and outputs that matter

  • text_agent_config - from a Text Agent Session node. Required.
  • original_prompt and final_prompt - the two endpoints of the chain. The whole point of the node.
  • negative_prompt - what you ended up excluding.
  • image_document_id - link to the ZMongo image document.
  • workflow_id / notes / extra_json - optional context.
  • context_pack - optional project context to record alongside.

Outputs: json (the save payload), ledger_document_id (the new record's ID - save this if you want to reference it later), success (BOOLEAN), and refresh.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo

Restart ComfyUI, or use ComfyUI Manager ("ComfyUI-ZMongo"). Pack's heavy requirements.txt applies (pymongo, langchain, sentence-transformers, transformers).

Common issues

  • success false, no LLM involved - the ledger write failed. Check json for the backend's error; it's usually an auth or collection-permissions problem on the hosted side.
  • "Missing ZMongo API session" - same as every Text Agents node: hosted API key session required, local file store won't do. Even though there's no Gemini call here, the write goes through the hosted backend.
  • Ledger growing out of control - this node appends a record every run. If you're executing a loop with Record Loop Manager, you'll get one entry per iteration, which is either exactly what provenance means or a disk-spend problem depending on how you look at it.
CategoryZMongo/07 Text Agents/Provenance

Inputs (10)

NameTypeDefaultDescription
text_agent_configZMONGO_TEXT_AGENT_CONFIG
original_promptSTRING
final_promptSTRING
negative_promptoptSTRING
context_packoptSTRING
image_document_idoptSTRING
workflow_idoptSTRING
notesoptSTRING
extra_jsonoptSTRING{}
refresh_tokenoptSTRING

Outputs (4)

NameTypeDescription
jsonSTRING
ledger_document_idSTRING
successBOOLEAN
refreshSTRING