10 Load Memory Capsule
Pull your saved prompts back into the graph
- text_agent_config
- capsule_context
- json
- document_id
- success
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 (defaultdefault_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'scapsule_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_contextwithsuccesstrue - the document loaded but none of the fields infield_paths_csvcontained 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_charstruncates, 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_nameis scoped byproject_namefrom your config. If you switched projects, the same name points at a different partition (or nothing).
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| text_agent_config | ZMONGO_TEXT_AGENT_CONFIG | — | |
| capsule_name | STRING | default_style | — |
| collection_overrideopt | STRING | — | |
| field_paths_csvopt | STRING | capsule_text,text,summary,payload.context_pack | — |
| max_charsopt | INT | 6000500–64000 | — |
| refresh_tokenopt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| capsule_context | STRING | — |
| json | STRING | — |
| document_id | STRING | — |
| success | BOOLEAN | — |