MemoryRead
Description
The Memory Read node retrieves a block of text stored in a local JSON file (the "memory"). It acts as a persistent key-value store that survives workflow restarts and application sessions, enabling data sharing between different workflows or between different runs of the same workflow.
Unlike a variable that lives only in memory during execution, the memory file is a real file on disk. This makes it ideal for caching AI-generated content, storing intermediate results, or passing data between workflows that don't share the same canvas.
Configuration Properties
📁 Filepath Section
TextBox
The path to the JSON memory file. By default, it points to Workbench\memory.json in the same directory as the TzuFlow executable (e.g., if TzuFlow.exe is in C:\TzuFlow\, the default path is C:\TzuFlow\Workbench\memory.json).
Browse...
Opens a standard Windows file dialog to select a different memory file. You can use any .json file — the memory is not limited to the default location.
💡 Tip: The
Workbenchfolder is a convention used by TzuFlow to centralize working files (memory, generated assets, logs), but it is not mandatory. You can store memory files anywhere on your disk.
🔑 Key Word Section
TextBox
The key (identifier) of the entry to read from the memory file. The memory file is a simple JSON dictionary where each key maps to a text value. If the key does not exist, the node outputs "Memory not found: [key]" downstream.
Input Section
ComboBox
Defines how the node behaves regarding its input anchor and which key it uses:
FixedKey
The node has no input anchor and acts as a source node. It always reads the key specified in the Key Word field, regardless of any upstream data. This is the simplest mode — use it when you always want to read the same memory entry.
InputAsKey
The node has one input anchor. The text received on this anchor is used as the key to search in the memory file. The Key Word field is ignored in this mode. This is useful when you want to dynamically choose which memory entry to read (e.g., iterating through a list of keys from a SequencerNode).
InputAsTrigger
The node has one input anchor, but the content received on this anchor is ignored. The node still reads the key specified in the Key Word field. The input only serves to force the execution order — the node waits for data to arrive before reading the memory. This is essential when you need to guarantee that a MemoryWrite has finished before this node reads, without actually passing the key dynamically.
Usage Example
"Read a cached AI summary":
- A previous workflow saved a summary under the key
"ArticleSummary"using aMemoryWritenode. - A Memory Read node with:
- Filepath:
Workbench\memory.json(default) - Key Word:
ArticleSummary - Input Mode:
FixedKey
- Filepath:
- An Agent node receives the summary and translates it.
"Dynamic key lookup":
- A
Sequencernode outputs a list of keys:Task1,Task2,Task3. - A Memory Read node with Input Mode:
InputAsKey. - For each key, the node retrieves the corresponding memory entry and sends it downstream.
"Wait for write to complete":
- An
Agentgenerates content and aMemoryWritesaves it under"Draft". - The
MemoryWriteoutput triggers a Memory Read node with Input Mode:InputAsTriggerand Key Word:Draft. - The read node waits for the write to finish (via the trigger input), then reads the freshly written content.
⚠️ Pitfalls to Avoid
FixedKey mode = source node: In FixedKey mode, the node has no input anchor and is treated as a source by the executor. It will execute at the very start of the workflow, in parallel with other source nodes. If you need it to run after another node (e.g., after a MemoryWrite), use InputAsTrigger mode instead.
Memory file format: The memory file must be a valid JSON dictionary (e.g., {"Key1": "Value1", "Key2": "Value2"}). If the file is corrupted or not valid JSON, the node will output an error message. Always let MemoryWrite manage the file — don't edit it manually unless you know the exact format.
Key not found: If the key does not exist in the memory file, the node outputs "Memory not found: [key]". This string is NOT empty, so it will NOT trigger a "wait" behavior in an IteratorNode with AdvanceOnSignal=True. If you need to detect missing keys, use a SwitchNode downstream to test for the "Memory not found" prefix.
Concurrent access: The memory file is read and written by multiple nodes potentially in parallel. While MemoryStorage uses locking internally, rapid successive reads/writes to the same file from different workflows can cause race conditions. For heavy concurrent usage, consider using separate memory files per workflow.
Large memory files: The entire memory file is loaded into memory on every read. If your memory file grows to several megabytes (e.g., storing full book chapters), every read becomes slow. Consider splitting your memory into multiple files by topic or using a database for large-scale storage.
InputAsTrigger ignores content: When using InputAsTrigger, the text received on the input anchor is completely discarded. Don't try to pass the key through this anchor — it won't work. Use InputAsKey if you need dynamic key selection.