Global Variables
These variables are available in all nodes:{{date}}— Current ISO timestamp (e.g.,2025-04-04T03:53:00.000Z){{run.id}}— Unique run ID (timestamp-based, e.g.,2025-04-04T03-53-00-123Z){{run.timestamp}}— Alias for{{run.id}}{{workflow.id}}— Workflow ID from the JSON file{{workflow.name}}— Workflow display name (fallback to ID or filename){{node.id}}— Current node ID (available in media nodes)
Upstream Node Variables
Access outputs from previous workflow nodes using the pattern{{nodeId.fieldName}}:
Basic Access Patterns
{{nodeId.output}}— Full JSON output envelope from the node{{nodeId.text}}— Thetextfield from the node output (most common){{nodeId.fieldName}}— Any specific field from the node output JSON
Common Pitfall: output vs text
Wrong:{{brand_review.output}} returns the full envelope:
{{brand_review.text}} returns just the payload:
Nested JSON Extraction
When a node’stext field contains JSON, ClawRecipes automatically extracts nested fields:
Example Node Output
Available Template Variables
{{nodeId.text}}— Raw JSON string{{nodeId.title}}— Extracted: “Product Launch”{{nodeId.approved_json}}— For non-string values: “true”
Deeply Nested Extraction
If the JSON contains nested objects, fields are flattened:{{nodeId.meta_json}}— Full meta object as JSON string{{nodeId.author}}— “John” (if meta.author is a string)
LLM Node Structured Output
LLM nodes withoutputFields configuration produce predictable JSON structures:
Configuration
Template Access
Usage Examples
LLM Prompt Template
File Path Templates
Media Node Prompts
Implementation Details
Template substitution happens in the workflow worker during node execution. The code path is:- Primary:
src/lib/workflows/workflow-worker.ts—buildTemplateVars()function - Utility:
src/lib/workflows/workflow-utils.ts—templateReplace()function
Variable Resolution Process
- Global vars are built from run metadata and timestamps
- Node outputs are loaded from each completed node’s output file
- JSON parsing attempts to extract fields from the
textfield - Nested extraction flattens nested objects with
_jsonsuffixes for non-strings - Template replacement applies all variables using simple string substitution
Performance Notes
- Variables are rebuilt for each node execution (fresh state)
- Large node outputs are fully loaded into memory during template resolution
- JSON parsing failures are silently ignored (graceful degradation)
Best Practices
Variable Naming
- Use descriptive node IDs:
brand_reviewnotstep1 - Design consistent output field names across nodes
- Use
outputFieldsfor structured LLM outputs
Error Handling
- Always provide fallbacks:
{{nodeId.title || "Untitled"}} - Test templates with missing/malformed node outputs
- Use
{{nodeId.text}}when unsure about field structure
Memory Management
- Avoid extremely large text outputs in frequently-referenced nodes
- Consider splitting large data into separate file outputs
Common Patterns
Content Pipeline
Conditional Content
Related Documentation
- WORKFLOW_NODES.md — Node types and configuration
- WORKFLOW_EXAMPLES.md — Template usage examples
- MEDIA_GENERATION.md — Media node templates and variables
