Nodes/ComfyUI-ZMongo/10 Load Memory Capsule
ComfyUI Node

10 Load Memory Capsule

Pull your saved prompts back into the graph

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
10 Load Memory Capsule
  • text_agent_config
  • capsule_context
  • json
  • document_id
  • success
capsule_namedefault_style
collection_override
field_paths_csvcapsule_text,text,summary,payload.context_pack
max_chars6000
refresh_token

The load side of ZMongo's prompt memory system. Load Memory Capsule fetches a named memory document from your capsule collection and turns it into a plain string you can wire straight into a CLIP Text Encode or a prompt agent's context_pack. If Save Prompt Memory is the "don't lose the good prompt" node, this is the "hand me that prompt" node.

The name comes from the storage metaphor: a memory stored with a capsule_name is treated as a capsule - a bundle of text you can pop open mid-workflow. You give it a name like default_style, it finds the matching document in your project's capsule collection, and it extracts the text it needs.

How it works

The node queries the capsule collection (default text_agent_capsules) for the document matching your project and capsule_name, then walks the document's fields looking for text to return. The field_paths_csv input tells it where to look - the default is capsule_text,text,summary,payload.context_pack, so it checks a set of common field names and pulls the first content it finds. max_chars (default 6000, up to 64000) truncates the result so you don't blow out a CLIP encoder or an LLM context window with a huge stored blob.

The output is deliberately shaped for downstream use: capsule_context is the trimmed text you feed into your pipeline, json is the full document, document_id lets you trace which record satisfied the request, and success tells you whether the load actually worked.

Inputs and outputs that matter

  • text_agent_config - from a Text Agent Session node. Required; carries project + collection defaults.
  • capsule_name - which capsule to load (default default_style).
  • field_paths_csv - the dot-paths to search for text. Default covers the common cases; if your saved documents use custom field names, this is the input to edit.
  • max_chars - the truncation ceiling.
  • collection_override - only needed if your capsules live somewhere other than the session's capsule_collection.

Outputs: capsule_context (STRING - the value that matters), json, document_id, success.

Installing it

Pack-level install, one line:

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

Restart ComfyUI, or use ComfyUI Manager and search "ComfyUI-ZMongo". Remember the pack's requirements.txt is heavy (pymongo, langchain, sentence-transformers, transformers), so budget for a slow first install.

Common issues

  • Empty capsule_context with success true - the document loaded but none of the fields in field_paths_csv contained usable text. Add the actual field name to the CSV.
  • "Missing ZMongo API session" - Text Agents family needs a hosted API key session, not the local file store.
  • Loaded text is longer than you expected - max_chars truncates, so if your downstream conditioning gets weird, drop it from 6000 to something smaller. The min is 500, so you can go quite tight.
  • Wrong capsule keeps loading - capsule_name is scoped by project_name from your config. If you switched projects, the same name points at a different partition (or nothing).
CategoryZMongo/07 Text Agents/Memory

Inputs (6)

NameTypeDefaultDescription
text_agent_configZMONGO_TEXT_AGENT_CONFIG
capsule_nameSTRINGdefault_style
collection_overrideoptSTRING
field_paths_csvoptSTRINGcapsule_text,text,summary,payload.context_pack
max_charsoptINT6000500–64000
refresh_tokenoptSTRING

Outputs (4)

NameTypeDescription
capsule_contextSTRING
jsonSTRING
document_idSTRING
successBOOLEAN