Skip to main content

Workflow Memory Nodes

How to use memories in workflows to create, update, query, and retrieve persistent data.

Memory Nodes in Workflows

This is where memories become powerful. Memory nodes in workflows let you programmatically create, update, find, and query memories.

Add a Memory node to your workflow. You'll see four operations available: Create, Update, Find, and Query.

Creating Memories

Select "Create" as the operation.

Configure:

  • Folder - Which folder to create the memory in
  • Name - Static ("Customer Profile") or reference to a variable like {{customer_id}}
  • Content - The markdown content to store (usually output from a previous node)
  • Meta-fields - Key-value pairs for searchability (optional but useful)

Example flow:

  1. Workflow receives customer feedback via API
  2. AI prompt analyzes feedback and extracts key themes
  3. Memory node creates memory named after customer with analysis results
  4. Adds meta-fields: customer_segment, feedback_type, sentiment

Now that analysis persists. Future workflows can query or update it.

Updating Memories

Use the "Update" operation in a Memory node. You can:

  • Replace - Overwrite entire content with new content
  • Append - Add new information to existing content

Appending is powerful for building up context. Each time a workflow runs, it adds new findings to an existing memory instead of overwriting.

Example:

  • Memory contains: "Week 1: Competitor launched new feature X"
  • Workflow appends: "Week 2: Competitor adjusted pricing on feature X"
  • Memory now contains both pieces of information

When updating, you need to specify which memory to update. You can reference it by name (if you know the exact name) or by ID from a previous Find or Query operation.

Finding Specific Memories

Use the "Find" operation when you know the exact memory ID you need. This returns that specific memory's content, which becomes available as a variable for subsequent workflow nodes.

Useful when you have a structured naming system. If you always name customer memories by customer_id, you can find the right memory directly.

The Find operation returns:

  • Memory content
  • Meta-fields
  • Memory ID (for later updates)
  • Version information

Querying Memories

This is the most powerful operation. Query memories based on meta-field values you set during creation or updates.

Example queries:

  • All memories in "Customer Profiles" where sentiment = negative
  • All memories in "Research" where competitor = "CompanyX" and date > "2024-01-01"

The query returns matching memories. That data feeds into subsequent workflow nodes—maybe an AI prompt that analyzes all the negative feedback together to identify patterns.

You can query by:

  • Exact match: status = "active"
  • Comparison: priority > 5 or date >= "2024-01-01"
  • Existence: memories that have a specific metafield set

Data Flow Example

Weekly Competitive Analysis Workflow:

  1. Script node - Pulls data from competitor websites via API
  2. Prompt node - Analyzes data and extracts key findings
  3. Memory node (Create/Update) - Creates or updates memory for each competitor with this week's findings
    • Meta-fields: competitor_name, date, category
  4. Memory node (Query) - Retrieves all memories for this competitor from past month
  5. Prompt node - Analyzes trend across past month
  6. Memory node (Create) - Creates summary memory with trend analysis

Now you have:

  • Individual weekly memories for each competitor (detailed data)
  • Summary memories showing trends over time (analysis)
  • All queryable by competitor, date, category, or any other meta-fields

A separate monthly report workflow can query all the summary memories to generate an executive overview.

Practical Patterns

Customer Context Accumulation

Create one memory per customer. Each support interaction appends to that memory. Over time, you have a rich history of that customer's issues, preferences, and resolutions.

Implementation:

  1. Find memory for customer (by name: Customer_{{customer_id}})
  2. If exists: Update with append
  3. If not exists: Create new memory
  4. Use that accumulated context in your support response prompt

Research Aggregation

Each research workflow run creates memories with findings. Query workflows aggregate across all memories to identify patterns.

Implementation:

  1. Research workflow creates memories with meta-fields: date, source, topic
  2. Analysis workflow queries all memories from past month
  3. Aggregation prompt receives all that data
  4. Summary memory captures the analysis

Workflow State Management

Scheduled workflows use memories to track what's been processed, what's pending, and what's changed since the last run.

Implementation:

  1. Workflow starts: Find state memory (WorkflowState_{{workflow_name}})
  2. Read last_processed_id from memory content
  3. Process new items after that ID
  4. Update state memory with new last_processed_id

Team Knowledge Base

Workflows create memories summarizing meeting notes, decisions, or learnings. Team members query these memories to find relevant information.

Implementation:

  1. Meeting recording → transcript
  2. Prompt summarizes transcript
  3. Memory created with meta-fields: date, attendees, topics, decisions
  4. Team searches memories to find past decisions about specific topics

Caching External API Data

Workflows fetch data from slow or rate-limited APIs and cache results in memories. Other workflows query memories first before hitting the external API, reducing costs and latency.

Implementation:

  1. Query memory for cached data (by API endpoint + params)
  2. If found and not stale: Use cached data
  3. If not found or stale: Fetch from API
  4. Update memory with new data and timestamp

Using Memory Output in Subsequent Nodes

When a Memory node executes (Find or Query), it returns data that becomes available as variables.

Find operation returns:

  • {{memory_content}} - The markdown content
  • {{memory_meta}} - The meta-fields as JSON
  • {{memory_id}} - The unique ID

Query operation returns:

  • {{memories}} - Array of all matching memories
  • Each memory has: content, meta-fields, ID

Reference these variables in subsequent nodes. Pass {{memory_content}} to a prompt. Use {{memory_id}} in an Update operation. Loop through {{memories}} to process each result.

Tips for Workflow Memory Usage

Structure your meta-fields consistently - Use the same field names across all memories in a folder. This makes querying predictable.

Append for history, replace for state - If you're building up context over time, append. If you're tracking current state, replace.

Version check before critical operations - Query a memory before updating it to see what's there. Don't blindly overwrite.

Handle "not found" cases - When using Find, the memory might not exist yet. Build workflows that handle both creation and update paths.

Use descriptive variable names - When creating memories with variable names, make them descriptive. Customer_{{customer_id}} is better than mem_{{id}}.

Query narrow, then filter - Start with specific meta-field queries to reduce the data returned. Filter further in subsequent prompt or script nodes if needed.