From 28c5b581e992381f95f88ac4360659e52523f096 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:20:20 +0500 Subject: [PATCH 01/16] feat(n8n-expert): add Atlas agent definition - Add n8n-expert agent (Atlas) with 4 workflow triggers - Configure agent persona for n8n workflow automation - Include Context7 MCP integration for up-to-date docs - Add party-mode trigger for multi-agent collaboration - Author: Saif --- src/modules/bmm/agents/n8n-expert.agent.yaml | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/modules/bmm/agents/n8n-expert.agent.yaml diff --git a/src/modules/bmm/agents/n8n-expert.agent.yaml b/src/modules/bmm/agents/n8n-expert.agent.yaml new file mode 100644 index 00000000..396d6ada --- /dev/null +++ b/src/modules/bmm/agents/n8n-expert.agent.yaml @@ -0,0 +1,44 @@ +# n8n Expert Agent Definition + +agent: + webskip: true + metadata: + id: "{bmad_folder}/bmm/agents/n8n-expert.md" + name: Atlas + title: n8n Workflow Automation Expert + icon: 🔄 + module: bmm + + persona: + role: n8n Workflow Automation Specialist + identity: Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. + communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. + principles: | + - Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations. + - Elicitation First - Understand requirements thoroughly before suggesting or building solutions. + - Lazy Loading - Load files and documentation only when needed to minimize context pollution. + - Validation - Always validate workflow JSON syntax after creation. + - Platform Agnostic - Support migration from any automation platform with proper mapping. + - Error Recovery - NEVER delete files due to syntax errors, always fix them using error location information. + - Structured Approach - Follow task-specific workflows for different automation scenarios. + + menu: + - trigger: create-workflow + workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/create-workflow/workflow.yaml" + description: Create new n8n workflow from scratch based on requirements + + - trigger: modify-workflow + workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml" + description: Edit or update existing n8n workflow + + - trigger: migrate-workflow + workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml" + description: Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n + + - trigger: optimize-workflow + workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml" + description: Review and improve existing n8n workflows for performance and best practices + + - trigger: party-mode + workflow: "{project-root}/{bmad_folder}/core/workflows/party-mode/workflow.yaml" + description: Bring the whole team in to chat with other expert agents from the party From 9edc699a8fb22bffbba6cef1585b5edca2ad4f15 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:21:35 +0500 Subject: [PATCH 02/16] feat(n8n-expert): add shared resources for workflow creation - Add n8n-helpers.md with node creation guidelines - Add n8n-templates.yaml with 8 reusable workflow templates - Add platform-mappings.yaml for Zapier/Make/HubSpot/Power Automate migration - Include connection patterns and best practices --- .../n8n-expert/_shared/n8n-helpers.md | 201 ++++++++++++ .../n8n-expert/_shared/n8n-templates.yaml | 299 ++++++++++++++++++ .../n8n-expert/_shared/platform-mappings.yaml | 282 +++++++++++++++++ 3 files changed, 782 insertions(+) create mode 100644 src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md create mode 100644 src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml create mode 100644 src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md b/src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md new file mode 100644 index 00000000..d46aa1d6 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md @@ -0,0 +1,201 @@ +# n8n Workflow Helpers + +## Node Creation Guidelines + +### Basic Node Structure + +```json +{ + "id": "unique-node-id", + "name": "Node Name", + "type": "n8n-nodes-base.nodeName", + "typeVersion": 1, + "position": [x, y], + "parameters": {}, + "credentials": {} +} +``` + +### Node Positioning + +- Start node: [250, 300] +- Horizontal spacing: 220px between nodes +- Vertical spacing: 100px for parallel branches +- Grid alignment: Snap to 20px grid for clean layout + +### Common Node Types + +**Trigger Nodes:** + +- `n8n-nodes-base.webhook` - HTTP webhook trigger +- `n8n-nodes-base.scheduleTrigger` - Cron/interval trigger +- `n8n-nodes-base.manualTrigger` - Manual execution trigger +- `n8n-nodes-base.emailTrigger` - Email trigger + +**Action Nodes:** + +- `n8n-nodes-base.httpRequest` - HTTP API calls +- `n8n-nodes-base.set` - Data transformation +- `n8n-nodes-base.code` - Custom JavaScript/Python code +- `n8n-nodes-base.if` - Conditional branching +- `n8n-nodes-base.merge` - Merge data from multiple branches +- `n8n-nodes-base.splitInBatches` - Process data in batches + +**Integration Nodes:** + +- `n8n-nodes-base.googleSheets` - Google Sheets +- `n8n-nodes-base.slack` - Slack +- `n8n-nodes-base.notion` - Notion +- `n8n-nodes-base.airtable` - Airtable +- `n8n-nodes-base.postgres` - PostgreSQL +- `n8n-nodes-base.mysql` - MySQL + +## Connection Guidelines + +### Connection Structure + +```json +{ + "node": "Source Node Name", + "type": "main", + "index": 0 +} +``` + +### Connection Rules + +1. Each connection has a source node and target node +2. Main connections use type: "main" +3. Index 0 is default output, index 1+ for conditional branches +4. IF nodes have index 0 (true) and index 1 (false) +5. Always validate that referenced node names exist + +### Connection Patterns + +**Linear Flow:** + +``` +Trigger → Action1 → Action2 → End +``` + +**Conditional Branch:** + +``` +Trigger → IF Node → [true: Action1, false: Action2] → Merge +``` + +**Parallel Processing:** + +``` +Trigger → Split → [Branch1, Branch2, Branch3] → Merge +``` + +## Error Handling Best Practices + +### Error Workflow Pattern + +```json +{ + "name": "Error Handler", + "type": "n8n-nodes-base.errorTrigger", + "parameters": { + "errorWorkflows": ["workflow-id"] + } +} +``` + +### Retry Configuration + +```json +{ + "retryOnFail": true, + "maxTries": 3, + "waitBetweenTries": 1000 +} +``` + +## Data Transformation Patterns + +### Using Set Node + +```json +{ + "name": "Transform Data", + "type": "n8n-nodes-base.set", + "parameters": { + "mode": "manual", + "values": { + "string": [ + { + "name": "outputField", + "value": "={{ $json.inputField }}" + } + ] + } + } +} +``` + +### Using Code Node + +```json +{ + "name": "Custom Logic", + "type": "n8n-nodes-base.code", + "parameters": { + "language": "javaScript", + "jsCode": "return items.map(item => ({ json: { ...item.json, processed: true } }));" + } +} +``` + +## Credentials Management + +### Credential Reference + +```json +{ + "credentials": { + "httpBasicAuth": { + "id": "credential-id", + "name": "My API Credentials" + } + } +} +``` + +### Common Credential Types + +- `httpBasicAuth` - Basic authentication +- `oAuth2Api` - OAuth2 +- `httpHeaderAuth` - Header-based auth +- `httpQueryAuth` - Query parameter auth + +## Workflow Metadata + +### Required Fields + +```json +{ + "name": "Workflow Name", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [] +} +``` + +## Validation Checklist + +- [ ] All node IDs are unique +- [ ] All node names are unique +- [ ] All connections reference existing nodes +- [ ] Trigger node exists and is properly configured +- [ ] Node positions don't overlap +- [ ] Required parameters are set for each node +- [ ] Credentials are properly referenced +- [ ] Error handling is configured where needed +- [ ] JSON syntax is valid diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml b/src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml new file mode 100644 index 00000000..6e3ee4b1 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml @@ -0,0 +1,299 @@ +# n8n Workflow Templates + +# Basic webhook workflow template +webhook_workflow: + name: "Webhook Workflow" + nodes: + - id: "webhook_trigger" + name: "Webhook" + type: "n8n-nodes-base.webhook" + typeVersion: 1 + position: [250, 300] + parameters: + httpMethod: "POST" + path: "webhook-path" + responseMode: "onReceived" + - id: "process_data" + name: "Process Data" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [470, 300] + parameters: + mode: "manual" + values: {} + connections: + Webhook: + - - node: "Process Data" + type: "main" + index: 0 + +# Scheduled workflow template +scheduled_workflow: + name: "Scheduled Workflow" + nodes: + - id: "schedule_trigger" + name: "Schedule Trigger" + type: "n8n-nodes-base.scheduleTrigger" + typeVersion: 1 + position: [250, 300] + parameters: + rule: + interval: + - field: "hours" + hoursInterval: 1 + - id: "execute_action" + name: "Execute Action" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + connections: + Schedule Trigger: + - - node: "Execute Action" + type: "main" + index: 0 + +# Conditional workflow template +conditional_workflow: + name: "Conditional Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "if_condition" + name: "IF" + type: "n8n-nodes-base.if" + typeVersion: 1 + position: [470, 300] + parameters: + conditions: + boolean: [] + number: [] + string: [] + - id: "true_branch" + name: "True Branch" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [690, 200] + parameters: {} + - id: "false_branch" + name: "False Branch" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [690, 400] + parameters: {} + connections: + Manual Trigger: + - - node: "IF" + type: "main" + index: 0 + IF: + - - node: "True Branch" + type: "main" + index: 0 + - - node: "False Branch" + type: "main" + index: 0 + +# API integration workflow template +api_integration_workflow: + name: "API Integration Workflow" + nodes: + - id: "webhook_trigger" + name: "Webhook" + type: "n8n-nodes-base.webhook" + typeVersion: 1 + position: [250, 300] + parameters: + httpMethod: "POST" + path: "api-webhook" + responseMode: "onReceived" + - id: "http_request" + name: "HTTP Request" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "POST" + url: "" + jsonParameters: true + options: {} + - id: "transform_response" + name: "Transform Response" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [690, 300] + parameters: + mode: "manual" + values: {} + connections: + Webhook: + - - node: "HTTP Request" + type: "main" + index: 0 + HTTP Request: + - - node: "Transform Response" + type: "main" + index: 0 + +# Database workflow template +database_workflow: + name: "Database Workflow" + nodes: + - id: "schedule_trigger" + name: "Schedule Trigger" + type: "n8n-nodes-base.scheduleTrigger" + typeVersion: 1 + position: [250, 300] + parameters: + rule: + interval: + - field: "minutes" + minutesInterval: 15 + - id: "postgres_query" + name: "Postgres" + type: "n8n-nodes-base.postgres" + typeVersion: 1 + position: [470, 300] + parameters: + operation: "executeQuery" + query: "" + - id: "process_results" + name: "Process Results" + type: "n8n-nodes-base.code" + typeVersion: 1 + position: [690, 300] + parameters: + language: "javaScript" + jsCode: "return items;" + connections: + Schedule Trigger: + - - node: "Postgres" + type: "main" + index: 0 + Postgres: + - - node: "Process Results" + type: "main" + index: 0 + +# Error handling workflow template +error_handling_workflow: + name: "Error Handling Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "risky_operation" + name: "Risky Operation" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + continueOnFail: true + retryOnFail: true + maxTries: 3 + waitBetweenTries: 1000 + - id: "check_error" + name: "Check for Error" + type: "n8n-nodes-base.if" + typeVersion: 1 + position: [690, 300] + parameters: + conditions: + boolean: + - value1: "={{ $json.error !== undefined }}" + value2: true + - id: "handle_error" + name: "Handle Error" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [910, 200] + parameters: + mode: "manual" + values: + string: + - name: "status" + value: "error" + - id: "success_path" + name: "Success Path" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [910, 400] + parameters: {} + connections: + Manual Trigger: + - - node: "Risky Operation" + type: "main" + index: 0 + Risky Operation: + - - node: "Check for Error" + type: "main" + index: 0 + Check for Error: + - - node: "Handle Error" + type: "main" + index: 0 + - - node: "Success Path" + type: "main" + index: 0 + +# Batch processing workflow template +batch_processing_workflow: + name: "Batch Processing Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "get_data" + name: "Get Data" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + - id: "split_batches" + name: "Split In Batches" + type: "n8n-nodes-base.splitInBatches" + typeVersion: 1 + position: [690, 300] + parameters: + batchSize: 10 + - id: "process_batch" + name: "Process Batch" + type: "n8n-nodes-base.code" + typeVersion: 1 + position: [910, 300] + parameters: + language: "javaScript" + jsCode: "return items;" + connections: + Manual Trigger: + - - node: "Get Data" + type: "main" + index: 0 + Get Data: + - - node: "Split In Batches" + type: "main" + index: 0 + Split In Batches: + - - node: "Process Batch" + type: "main" + index: 0 + Process Batch: + - - node: "Split In Batches" + type: "main" + index: 0 diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml b/src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml new file mode 100644 index 00000000..059bed6c --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml @@ -0,0 +1,282 @@ +# Platform Migration Mappings +# Maps common automation platform concepts to n8n equivalents + +# Zapier to n8n mappings +zapier: + triggers: + "New Email": + n8n_node: "n8n-nodes-base.emailTrigger" + notes: "Configure IMAP/POP3 credentials" + "Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Use POST method by default" + "Schedule": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Convert Zapier schedule format to cron" + "New Row in Google Sheets": + n8n_node: "n8n-nodes-base.googleSheetsTrigger" + notes: "Requires Google OAuth credentials" + "New Slack Message": + n8n_node: "n8n-nodes-base.slackTrigger" + notes: "Configure channel and event type" + + actions: + "Send Email": + n8n_node: "n8n-nodes-base.emailSend" + notes: "Configure SMTP credentials" + "HTTP Request": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map method, URL, headers, and body" + "Create Google Sheets Row": + n8n_node: "n8n-nodes-base.googleSheets" + parameters: + operation: "append" + "Send Slack Message": + n8n_node: "n8n-nodes-base.slack" + parameters: + operation: "post" + resource: "message" + "Delay": + n8n_node: "n8n-nodes-base.wait" + notes: "Convert delay duration to milliseconds" + "Filter": + n8n_node: "n8n-nodes-base.if" + notes: "Convert filter conditions to IF node logic" + "Formatter": + n8n_node: "n8n-nodes-base.set" + notes: "Use Set node for data transformation" + "Code": + n8n_node: "n8n-nodes-base.code" + notes: "JavaScript or Python code execution" + + concepts: + "Multi-step Zap": + n8n_equivalent: "Linear workflow with connected nodes" + "Paths": + n8n_equivalent: "IF node with multiple branches" + "Filters": + n8n_equivalent: "IF node with conditions" + "Formatter": + n8n_equivalent: "Set node or Code node" + "Looping": + n8n_equivalent: "Split In Batches node" + +# Make (Integromat) to n8n mappings +make: + triggers: + "Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Direct equivalent" + "Watch Records": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Combine with polling logic in Code node" + "Custom Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Configure response mode" + + actions: + "HTTP Request": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map all HTTP parameters" + "Router": + n8n_node: "n8n-nodes-base.switch" + notes: "Multiple conditional branches" + "Iterator": + n8n_node: "n8n-nodes-base.splitInBatches" + notes: "Process array items individually" + "Aggregator": + n8n_node: "n8n-nodes-base.merge" + notes: "Combine data from multiple sources" + "Data Store": + n8n_node: "n8n-nodes-base.redis" + notes: "Use Redis or database node for storage" + "JSON Parser": + n8n_node: "n8n-nodes-base.code" + notes: "Parse JSON in Code node" + "Text Parser": + n8n_node: "n8n-nodes-base.set" + notes: "Use expressions for text manipulation" + + concepts: + "Scenario": + n8n_equivalent: "Workflow" + "Module": + n8n_equivalent: "Node" + "Route": + n8n_equivalent: "Connection" + "Filter": + n8n_equivalent: "IF node" + "Router": + n8n_equivalent: "Switch node or multiple IF nodes" + "Iterator": + n8n_equivalent: "Split In Batches node" + "Aggregator": + n8n_equivalent: "Merge node" + +# HubSpot Workflows to n8n mappings +hubspot: + triggers: + "Contact Property Change": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Configure webhook for property updates" + "Deal Stage Change": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Monitor deal pipeline changes" + "Form Submission": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Webhook for form submissions" + "List Membership": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Poll HubSpot API for list changes" + + actions: + "Update Contact Property": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "contact" + operation: "update" + "Create Deal": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "deal" + operation: "create" + "Send Email": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "email" + operation: "send" + "Add to List": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "contact" + operation: "addToList" + "Create Task": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "task" + operation: "create" + + concepts: + "Enrollment Trigger": + n8n_equivalent: "Trigger node (webhook or schedule)" + "If/Then Branch": + n8n_equivalent: "IF node" + "Delay": + n8n_equivalent: "Wait node" + "Goal": + n8n_equivalent: "IF node checking completion criteria" + "Re-enrollment": + n8n_equivalent: "Workflow settings with loop detection" + +# Microsoft Power Automate to n8n mappings +power_automate: + triggers: + "When an item is created": + n8n_node: "n8n-nodes-base.webhook" + notes: "Configure webhook for item creation events" + "Recurrence": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Convert recurrence pattern to cron" + "When a HTTP request is received": + n8n_node: "n8n-nodes-base.webhook" + notes: "Direct equivalent" + + actions: + "HTTP": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map all HTTP parameters" + "Condition": + n8n_node: "n8n-nodes-base.if" + notes: "Convert condition logic" + "Apply to each": + n8n_node: "n8n-nodes-base.splitInBatches" + notes: "Process array items" + "Compose": + n8n_node: "n8n-nodes-base.set" + notes: "Data transformation" + "Parse JSON": + n8n_node: "n8n-nodes-base.code" + notes: "Parse JSON in Code node" + "Delay": + n8n_node: "n8n-nodes-base.wait" + notes: "Convert delay duration" + + concepts: + "Flow": + n8n_equivalent: "Workflow" + "Action": + n8n_equivalent: "Node" + "Condition": + n8n_equivalent: "IF node" + "Switch": + n8n_equivalent: "Switch node" + "Scope": + n8n_equivalent: "Error handling with try/catch in Code node" + "Apply to each": + n8n_equivalent: "Split In Batches node" + +# Common patterns across platforms +common_patterns: + conditional_logic: + description: "If/then/else branching" + n8n_implementation: "IF node with true/false branches" + + loops: + description: "Iterate over array items" + n8n_implementation: "Split In Batches node" + + data_transformation: + description: "Transform, format, or map data" + n8n_implementation: "Set node or Code node" + + error_handling: + description: "Handle errors and retries" + n8n_implementation: "Node settings: continueOnFail, retryOnFail, maxTries" + + delays: + description: "Wait before next action" + n8n_implementation: "Wait node with duration" + + webhooks: + description: "Receive HTTP requests" + n8n_implementation: "Webhook node with response configuration" + + api_calls: + description: "Make HTTP requests to APIs" + n8n_implementation: "HTTP Request node" + + parallel_execution: + description: "Execute multiple actions simultaneously" + n8n_implementation: "Multiple connections from single node" + + merge_data: + description: "Combine data from multiple sources" + n8n_implementation: "Merge node" + +# Migration considerations +migration_notes: + authentication: + - "Recreate all credentials in n8n" + - "OAuth flows may need re-authorization" + - "API keys and tokens must be securely stored" + + scheduling: + - "Convert platform-specific schedules to cron expressions" + - "Consider timezone differences" + - "Test schedule triggers before going live" + + data_formats: + - "Verify JSON structure compatibility" + - "Check date/time format conversions" + - "Validate data type mappings" + + error_handling: + - "Implement retry logic where needed" + - "Add error notification workflows" + - "Test failure scenarios" + + testing: + - "Test with sample data first" + - "Verify all integrations work correctly" + - "Monitor initial executions closely" + - "Compare outputs with original platform" From 02d07ed25450d4a3a431daafe296eeaca90a4cf6 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:22:44 +0500 Subject: [PATCH 03/16] feat(n8n-expert): add create-workflow workflow - Add workflow.yaml with configuration and variables - Add instructions.md with full elicitation and Context7 integration - Add checklist.md for validation - Supports building n8n workflows from scratch with smart elicitation --- .../n8n-expert/create-workflow/checklist.md | 74 ++++ .../create-workflow/instructions.md | 350 ++++++++++++++++++ .../n8n-expert/create-workflow/workflow.yaml | 31 ++ 3 files changed, 455 insertions(+) create mode 100644 src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md create mode 100644 src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md create mode 100644 src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md b/src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md new file mode 100644 index 00000000..dcd96098 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md @@ -0,0 +1,74 @@ +# Create n8n Workflow - Validation Checklist + +## Workflow Structure + +- [ ] Workflow has a valid name +- [ ] Workflow contains at least one trigger node +- [ ] All nodes have unique IDs +- [ ] All nodes have unique names +- [ ] Workflow JSON is valid and parseable + +## Node Configuration + +- [ ] Trigger node is properly configured +- [ ] All action nodes have required parameters set +- [ ] Node types are valid n8n node types +- [ ] Node positions are set and don't overlap +- [ ] TypeVersion is set for all nodes (usually 1) + +## Connections + +- [ ] All nodes are connected (no orphaned nodes except trigger) +- [ ] All connections reference existing node names +- [ ] Connection types are set correctly (usually "main") +- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) +- [ ] No circular dependencies (unless intentional loops) + +## Error Handling + +- [ ] Error handling strategy matches requirements +- [ ] Critical nodes have retry logic if needed +- [ ] continueOnFail is set appropriately +- [ ] maxTries and waitBetweenTries are configured if retries enabled + +## Data Flow + +- [ ] Data transformations are properly configured +- [ ] Set nodes have correct value mappings +- [ ] Code nodes have valid JavaScript/Python code +- [ ] Expressions use correct n8n syntax (={{ }}) + +## Integrations + +- [ ] All required integrations are included +- [ ] Credential placeholders are set for authenticated services +- [ ] API endpoints and methods are correct +- [ ] Request/response formats are properly configured + +## Best Practices + +- [ ] Workflow follows n8n naming conventions +- [ ] Nodes are logically organized and positioned +- [ ] Complex logic is broken into manageable steps +- [ ] Workflow is documented (node names are descriptive) + +## Testing Readiness + +- [ ] Workflow can be imported into n8n without errors +- [ ] All required credentials are identified +- [ ] Test data requirements are clear +- [ ] Expected outputs are defined + +## File Output + +- [ ] File is saved to correct location +- [ ] File has .json extension +- [ ] File is valid JSON (passes JSON.parse) +- [ ] File size is reasonable (not corrupted) + +## Documentation + +- [ ] User has been informed how to import workflow +- [ ] Credential requirements have been communicated +- [ ] Testing instructions have been provided +- [ ] Any special configuration notes have been shared diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md b/src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md new file mode 100644 index 00000000..161ddb27 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md @@ -0,0 +1,350 @@ +# Create n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow creates a new n8n workflow from scratch based on user requirements. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow type, trigger, integrations, complexity, requirements + + + Summarize your understanding + Skip directly to Step 2 (Check Context7 MCP) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "What type of automation workflow do you need?" + Present numbered options: + 1. Webhook-based - Receive HTTP requests and process data + 2. Scheduled - Run on a schedule (cron/interval) + 3. Event-driven - Trigger from external service events + 4. Manual - Execute on demand + 5. Database-driven - Trigger from database changes + 6. Other - Describe your specific trigger needs + + WAIT for user selection (1-6) + Store selection in {{workflow_type}} + + + Ask: "Please describe your trigger requirements" + WAIT for user input + Store in {{workflow_type}} + + + Ask Question 2: "What integrations or services will this workflow use?" + Present numbered options: + 1. HTTP/REST APIs - Generic API calls + 2. Databases - PostgreSQL, MySQL, MongoDB, etc. + 3. Cloud Services - Google Sheets, Slack, Notion, Airtable + 4. Email - Send/receive emails + 5. CRM - HubSpot, Salesforce, etc. + 6. Custom Code - JavaScript/Python logic + 7. Multiple - Combination of above + 8. Other - Specify integrations + + WAIT for user selection (1-8) + Store selection in {{integrations}} + + + Ask: "Please list all integrations needed (comma-separated)" + WAIT for user input + Store in {{integrations}} + + + Ask Question 3: "How complex is your workflow logic?" + Present numbered options: + 1. Simple (3-5 nodes) - Linear flow with minimal logic + 2. Medium (6-10 nodes) - Some conditional logic or branching + 3. Complex (11-20 nodes) - Multiple branches, loops, or error handling + 4. Very Complex (20+ nodes) - Advanced logic with parallel processing + + WAIT for user selection (1-4) + Store selection in {{complexity}} + + Ask Question 4: "Do you need error handling and retry logic?" + Present numbered options: + 1. No - Simple workflow without error handling + 2. Basic - Retry failed operations automatically + 3. Advanced - Custom error handling with notifications + 4. Comprehensive - Full error workflow with logging and alerts + + WAIT for user selection (1-4) + Store selection in {{error_handling}} + + Ask Question 5: "What should the workflow be named?" + WAIT for user input + Store in {{workflow_name}} + + Ask Question 6: "Where should the workflow file be saved?" + Present numbered options: + 1. Default location - workflows/[workflow-name].json + 2. Custom path - Specify your own file path + 3. Project root - Save in main project directory + 4. Specific folder - Choose from existing folders + + WAIT for user selection (1-4) + + Ask for specific path + WAIT for user input + + Store final path in {{save_location}} + + Ask Question 7: "Any additional requirements or specific logic needed?" + Present numbered options: + 1. No - Proceed with current requirements + 2. Yes - Describe additional requirements + + WAIT for user selection (1-2) + + Ask: "Please describe additional requirements" + WAIT for user input + Store in {{additional_requirements}} + + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 3 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation." + Ask: "Would you like help setting up Context7 MCP? (yes/no)" + WAIT for user response + + + Guide user through Context7 MCP setup: + 1. Inform user: "Context7 MCP requires the 'uvx' command (part of uv Python package manager)" + 2. Ask: "Do you have 'uv' installed? (yes/no/not sure)" + WAIT for response + + + Provide installation guidance: + - macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh + - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" + - Or via pip: pip install uv + Ask user to install and confirm when ready + WAIT for confirmation + + + 3. Inform user: "Please configure Context7 MCP in your IDE's MCP settings with:" + + Server name: context7 + Command: uvx + Args: ["context7"] + Auto-approve tools: ["resolve-library-id", "get-library-docs"] + + 4. Ask user to reconnect/restart MCP servers in their IDE + 5. Wait for user confirmation that MCP is reconnected + 6. Verify Context7 is now available + Store result in {{context7_available}} + + + + Inform: "Proceeding without Context7. Using built-in n8n knowledge." + Proceed to Step 4 + + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Workflow type: {{workflow_type}} + - Integrations: {{integrations}} + - Complexity: {{complexity}} + Store relevant documentation snippets for reference + + + + Skip Context7 query + Use built-in knowledge and templates + + + + + Based on gathered requirements, plan the workflow structure: + 1. Identify trigger node type + 2. List all action nodes needed + 3. Identify conditional logic (IF nodes) + 4. Plan data transformations (Set/Code nodes) + 5. Design error handling strategy + 6. Map node connections + + Present the planned structure to user in clear format: + - Trigger: [trigger type] + - Nodes: [list of nodes with descriptions] + - Logic: [conditional branches, loops] + - Error Handling: [strategy] + + Ask: "Does this structure meet your needs?" + Present numbered options: + 1. Yes - Proceed with this structure + 2. No - Adjust the structure + 3. Add more details - Provide additional requirements + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust structure based on feedback + Repeat this step + + + + + Load {{templates}} file + Identify closest matching template based on workflow type + Load {{helpers}} for node creation guidelines + Extract relevant template sections + + + + Follow guidelines from {{helpers}} for proper node creation + + Initialize workflow structure: + + { + "name": "{{workflow_name}}", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [] + } + + + Build nodes ONE at a time following these rules: + + For Each Node: + 1. Generate unique node ID + 2. Set node name (unique, descriptive) + 3. Set node type (e.g., n8n-nodes-base.webhook) + 4. Set typeVersion (usually 1) + 5. Calculate position: + - First node (trigger): [250, 300] + - Subsequent nodes: add 220 to x for each step + - Branches: adjust y by ±100 + 6. Configure parameters based on node type + 7. Add credentials if needed + 8. Set error handling options if required: + - continueOnFail: true/false + - retryOnFail: true/false + - maxTries: number + - waitBetweenTries: milliseconds + + + For Each Connection: + 1. Identify source node name + 2. Identify target node name + 3. Create connection entry in connections object: + "Source Node Name": [ + [ + { + "node": "Target Node Name", + "type": "main", + "index": 0 + } + ] + ] + 4. For IF nodes: + - index 0 = true branch + - index 1 = false branch + 5. Validate all referenced nodes exist + + + Node Building Order: + 1. Trigger node + 2. Main flow action nodes + 3. Conditional nodes (IF/Switch) + 4. Branch nodes + 5. Merge nodes + 6. Final action nodes + 7. Connect all nodes + + + Apply error handling based on {{error_handling}} selection + Validate all node IDs are unique + Validate all node names are unique + Validate all connections reference existing nodes + + + + Review workflow for optimization: + - Remove any unused nodes + - Verify node positions don't overlap + - Ensure proper spacing and alignment + - Validate all required parameters are set + + Save workflow to {{save_location}} + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "n8n workflow created at {{save_location}}" + + + + Inform user how to use the workflow: + 1. Import the JSON file into n8n + 2. Configure credentials for integrated services + 3. Test the workflow with sample data + 4. Activate the workflow when ready + + Ask: "Would you like me to explain any part of the workflow?" + Present numbered options: + 1. No - I'm good to go + 2. Yes - Explain specific nodes + 3. Yes - Explain the overall flow + 4. Yes - Explain how to test it + + WAIT for user selection (1-4) + + + Provide requested explanation + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml b/src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml new file mode 100644 index 00000000..32705349 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml @@ -0,0 +1,31 @@ +name: create-workflow +description: "Create new n8n workflow from scratch based on requirements" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/create-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_type: "" # Will be elicited + trigger_type: "" # Will be elicited + integrations: [] # Will be elicited + complexity: "" # Will be elicited + error_handling: "" # Will be elicited + save_location: "" # Will be elicited + workflow_name: "" # Will be elicited + additional_requirements: "" # Will be elicited + context7_available: false # Will be checked + +default_output_file: "{project-root}/workflows/workflow-{timestamp}.json" + +standalone: true +web_bundle: false From 83c0a598873689d2d059e39d7b2188c4dee93e6e Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:28:15 +0500 Subject: [PATCH 04/16] feat(n8n-expert): add modify-workflow workflow - Add workflow.yaml with configuration for editing workflows - Add instructions.md with backup and modification workflow - Add checklist.md for modification validation - Supports editing existing n8n workflows with safety --- .../n8n-expert/modify-workflow/checklist.md | 90 +++++ .../modify-workflow/instructions.md | 327 ++++++++++++++++++ .../n8n-expert/modify-workflow/workflow.yaml | 30 ++ 3 files changed, 447 insertions(+) create mode 100644 src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md create mode 100644 src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md create mode 100644 src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md b/src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md new file mode 100644 index 00000000..9534b32b --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md @@ -0,0 +1,90 @@ +# Modify n8n Workflow - Validation Checklist + +## Pre-Modification + +- [ ] Original workflow file was successfully loaded +- [ ] Workflow JSON was valid before modifications +- [ ] Backup was created before making changes +- [ ] User requirements were clearly understood + +## Workflow Structure + +- [ ] Workflow maintains valid JSON structure +- [ ] Workflow name is preserved (unless intentionally changed) +- [ ] All nodes still have unique IDs +- [ ] All nodes still have unique names +- [ ] Workflow settings are preserved + +## Node Modifications + +- [ ] Added nodes have unique IDs +- [ ] Added nodes have unique names +- [ ] Added nodes have valid node types +- [ ] Added nodes have required parameters set +- [ ] Modified nodes preserve their IDs +- [ ] Modified nodes have valid parameter values +- [ ] Removed nodes are completely removed from nodes array + +## Connections + +- [ ] All connections reference existing nodes +- [ ] Connections to/from added nodes are properly configured +- [ ] Connections affected by removed nodes are updated +- [ ] No orphaned connections remain +- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) +- [ ] No circular dependencies (unless intentional) + +## Node Positioning + +- [ ] New nodes have valid positions +- [ ] New nodes don't overlap with existing nodes +- [ ] Node positions follow spacing guidelines (220px horizontal) +- [ ] Branch nodes have appropriate vertical spacing (±100px) + +## Error Handling + +- [ ] Error handling modifications are applied correctly +- [ ] Retry logic is properly configured if added +- [ ] continueOnFail settings are appropriate +- [ ] maxTries and waitBetweenTries are set if retries enabled + +## Data Flow + +- [ ] Data flow is maintained after modifications +- [ ] New transformations are properly configured +- [ ] Expressions use correct n8n syntax (={{ }}) +- [ ] No data flow breaks introduced + +## Integration Changes + +- [ ] New integrations are properly configured +- [ ] Credential requirements are identified +- [ ] API configurations are correct +- [ ] Existing integrations still work + +## Validation + +- [ ] Modified workflow passes JSON validation +- [ ] All modifications match user requirements +- [ ] No unintended changes were made +- [ ] Workflow structure is still logical + +## Backup & Recovery + +- [ ] Backup file was created successfully +- [ ] Backup location was communicated to user +- [ ] Original workflow can be restored if needed + +## Testing Readiness + +- [ ] Modified workflow can be imported into n8n +- [ ] Changes are testable +- [ ] Expected behavior is clear +- [ ] Any new credentials needed are identified + +## Documentation + +- [ ] Changes made are summarized for user +- [ ] User understands what was modified +- [ ] Testing recommendations provided if needed +- [ ] Backup location shared with user diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md b/src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md new file mode 100644 index 00000000..5f086d95 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md @@ -0,0 +1,327 @@ +# Modify n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow modifies an existing n8n workflow based on user requirements. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow file path, changes needed, specific nodes + + + Summarize your understanding + Skip directly to Step 2 (Load Existing Workflow) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which workflow file do you want to modify?" + Present numbered options: + 1. Provide file path - Specify exact path to workflow JSON + 2. Search in workflows folder - List available workflows + 3. Paste workflow JSON - Provide workflow content directly + + WAIT for user selection (1-3) + + + Ask: "Please provide the file path to the workflow JSON" + WAIT for user input + Store in {{workflow_file}} + + + + List all .json files in workflows/ directory + Present as numbered list + WAIT for user selection + Store selected file path in {{workflow_file}} + + + + Ask: "Please paste the workflow JSON content" + WAIT for user input + Create temporary file with content + Store temp file path in {{workflow_file}} + + + Ask Question 2: "What type of modification do you need?" + Present numbered options: + 1. Add new nodes - Add functionality to existing workflow + 2. Modify existing nodes - Change node parameters or configuration + 3. Remove nodes - Delete nodes from workflow + 4. Change connections - Modify how nodes are connected + 5. Update error handling - Add or modify retry/error logic + 6. Optimize workflow - Improve performance or structure + 7. Multiple changes - Combination of above + + WAIT for user selection (1-7) + Store selection in {{modification_type}} + + Ask Question 3: "Please describe the changes you want to make" + WAIT for user input + Store in {{changes_description}} + + + Ask: "What nodes do you want to add? (describe functionality)" + WAIT for user input + Store in {{nodes_to_add}} + + + + Ask: "Which nodes do you want to modify? (provide node names or descriptions)" + WAIT for user input + Store in {{nodes_to_modify}} + + + + Ask: "Which nodes do you want to remove? (provide node names)" + WAIT for user input + Store in {{nodes_to_remove}} + + + + + Only load the workflow file when user provides it - never preload + + Read workflow file from {{workflow_file}} + Parse JSON content + Validate JSON structure + + + Inform user: "The workflow file has invalid JSON syntax" + Show error details + Ask: "Would you like me to fix the JSON syntax first? (yes/no)" + WAIT for user response + + + Fix JSON syntax errors + Save corrected file + Proceed with loading + + + + Exit workflow with error + + + + Extract workflow structure: + - Workflow name + - List of nodes (names, types, IDs) + - Connections map + - Current settings + + Display workflow summary to user: + - Name: [workflow name] + - Nodes: [count] nodes + - Node list: [node names and types] + - Connections: [connection count] + + + + Create backup of original workflow + Save backup to: {{workflow_file}}.backup-{timestamp} + Store true in {{backup_created}} + Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 5 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Proceeding with built-in knowledge." + Proceed to Step 6 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Modification type: {{modification_type}} + - Nodes to add: {{nodes_to_add}} + - Changes description: {{changes_description}} + Store relevant documentation snippets for reference + + + + + Load {{helpers}} for node creation guidelines + Analyze current workflow structure + Plan modifications based on requirements: + + + 1. Identify where new nodes should be inserted + 2. Determine node types needed + 3. Plan connections to/from new nodes + 4. Calculate positions for new nodes + + + + 1. Identify nodes to modify by name or ID + 2. Determine what parameters to change + 3. Validate new parameter values + + + + 1. Identify nodes to remove by name or ID + 2. Identify connections that will be affected + 3. Plan how to reconnect remaining nodes + + + + 1. Identify connections to modify + 2. Validate new connection targets exist + 3. Update connection indices if needed + + + Present modification plan to user: + - Changes to be made: [detailed list] + - Nodes affected: [list] + - New connections: [list] + - Removed connections: [list] + + Ask: "Does this modification plan look correct?" + Present numbered options: + 1. Yes - Proceed with modifications + 2. No - Adjust the plan + 3. Add more changes - Include additional modifications + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust plan based on feedback + Repeat this step + + + + + Follow guidelines from {{helpers}} for proper node creation + + Load current workflow JSON into memory + + If Adding Nodes: + 1. Generate unique node IDs (check against existing IDs) + 2. Create node objects with proper structure + 3. Calculate positions (avoid overlaps with existing nodes) + 4. Add nodes to workflow.nodes array + 5. Create connections to/from new nodes + 6. Update connections object + + + If Modifying Nodes: + 1. Find nodes by name or ID + 2. Update parameters as specified + 3. Preserve node ID and other unchanged properties + 4. Validate new parameter values + 5. Update node in workflow.nodes array + + + If Removing Nodes: + 1. Find nodes by name or ID + 2. Remove from workflow.nodes array + 3. Remove all connections to/from removed nodes + 4. Update connections object + 5. Reconnect remaining nodes if needed + + + If Changing Connections: + 1. Update connections object + 2. Validate all referenced nodes exist + 3. Ensure connection indices are correct + 4. Remove orphaned connections + + + If Updating Error Handling: + 1. Find affected nodes + 2. Add or update error handling properties: + - continueOnFail + - retryOnFail + - maxTries + - waitBetweenTries + 3. Validate error handling configuration + + + Validate modified workflow: + - All node IDs are unique + - All node names are unique + - All connections reference existing nodes + - No orphaned nodes (except trigger) + - Node positions don't overlap + + + + Save modified workflow to {{workflow_file}} + Preserve original file location + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow modified successfully at {{workflow_file}}" + + + + Provide summary of changes made: + - Nodes added: [count and names] + - Nodes modified: [count and names] + - Nodes removed: [count and names] + - Connections changed: [count] + - Backup location: {{workflow_file}}.backup-{timestamp} + + Ask: "Would you like to make additional changes?" + Present numbered options: + 1. No - I'm done + 2. Yes - Make more modifications + 3. Revert - Restore from backup + + WAIT for user selection (1-3) + + + Return to Step 1 with current workflow + + + + Restore workflow from backup + Confirm restoration to user + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml b/src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml new file mode 100644 index 00000000..4ec24de8 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml @@ -0,0 +1,30 @@ +name: modify-workflow +description: "Edit or update existing n8n workflow" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/modify-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_file: "" # Will be elicited + modification_type: "" # Will be elicited + changes_description: "" # Will be elicited + nodes_to_add: [] # Will be elicited + nodes_to_modify: [] # Will be elicited + nodes_to_remove: [] # Will be elicited + backup_created: false # Will be set + context7_available: false # Will be checked + +default_output_file: "" # Will use existing file location + +standalone: true +web_bundle: false From 74240cf84208c20f2315efd4c9b2fe03f97306dc Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:29:25 +0500 Subject: [PATCH 05/16] feat(n8n-expert): add migrate-workflow workflow - Add workflow.yaml with configuration for platform migration - Add instructions.md with platform analysis and mapping workflow - Add checklist.md for migration validation - Supports migration from Zapier, Make, HubSpot, Power Automate --- .../n8n-expert/migrate-workflow/checklist.md | 110 ++++++ .../migrate-workflow/instructions.md | 350 ++++++++++++++++++ .../n8n-expert/migrate-workflow/workflow.yaml | 32 ++ 3 files changed, 492 insertions(+) create mode 100644 src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md create mode 100644 src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md create mode 100644 src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md new file mode 100644 index 00000000..22e6e675 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md @@ -0,0 +1,110 @@ +# Migrate Workflow to n8n - Validation Checklist + +## Source Analysis + +- [ ] Source platform was identified +- [ ] Source workflow details were gathered +- [ ] Trigger type was identified +- [ ] All integrations were identified +- [ ] Workflow complexity was assessed + +## Platform Mapping + +- [ ] Platform mappings were loaded +- [ ] Source trigger was mapped to n8n trigger +- [ ] All source actions were mapped to n8n nodes +- [ ] Conditional logic was mapped correctly +- [ ] Loops/iterations were mapped correctly +- [ ] Data transformations were identified + +## Workflow Structure + +- [ ] n8n workflow has valid JSON structure +- [ ] Workflow name is set +- [ ] Migration tag is added (migrated-from-[platform]) +- [ ] All nodes have unique IDs +- [ ] All nodes have unique names +- [ ] Trigger node is properly configured + +## Node Configuration + +- [ ] All mapped nodes are created +- [ ] Node types are valid n8n types +- [ ] Node parameters are configured +- [ ] Credentials placeholders are set +- [ ] Node positions are calculated correctly +- [ ] No overlapping nodes + +## Data Mappings + +- [ ] Field mappings from source to n8n are correct +- [ ] Data type conversions are handled +- [ ] Date/time format differences are addressed +- [ ] Expressions use correct n8n syntax (={{ }}) +- [ ] Set nodes are used for simple transformations +- [ ] Code nodes are used for complex transformations + +## Conditional Logic + +- [ ] IF nodes are created for conditional branches +- [ ] Switch nodes are created for multiple conditions +- [ ] Conditions are properly configured +- [ ] True/false branches are correct (index 0/1) +- [ ] All branches are connected + +## Connections + +- [ ] All nodes are connected properly +- [ ] Trigger connects to first action +- [ ] Actions are connected in sequence +- [ ] Conditional branches are connected +- [ ] Merge points are connected +- [ ] All connections reference existing nodes +- [ ] No orphaned nodes (except trigger) + +## Error Handling + +- [ ] Error handling strategy is defined +- [ ] Critical nodes have retry logic if needed +- [ ] continueOnFail is set appropriately +- [ ] Error handling matches or improves on source + +## Migration Notes + +- [ ] Source platform is documented +- [ ] Migration date is recorded +- [ ] Credentials needed are listed +- [ ] Platform-specific differences are noted +- [ ] Testing considerations are documented + +## Validation + +- [ ] Workflow passes JSON validation +- [ ] All required parameters are set +- [ ] Workflow structure is logical +- [ ] Migration matches source workflow functionality + +## Credentials & Authentication + +- [ ] All services requiring credentials are identified +- [ ] Credential types are correct for n8n +- [ ] OAuth requirements are noted +- [ ] API key requirements are noted +- [ ] Authentication differences from source are documented + +## Testing Readiness + +- [ ] Workflow can be imported into n8n +- [ ] Test data requirements are clear +- [ ] Expected outputs are defined +- [ ] Comparison approach with source is defined +- [ ] Initial monitoring plan is suggested + +## Documentation + +- [ ] User has import instructions +- [ ] Credential setup guidance provided +- [ ] Data mapping explanations provided +- [ ] Testing approach explained +- [ ] Platform differences highlighted +- [ ] Post-migration checklist provided diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md new file mode 100644 index 00000000..17ffd53d --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md @@ -0,0 +1,350 @@ +# Migrate Workflow to n8n - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow migrates automation workflows from other platforms to n8n. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: source platform, workflow details, integrations, file paths + + + Summarize your understanding + Skip directly to Step 2 (Check Context7 MCP) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which platform are you migrating from?" + Present numbered options: + 1. Zapier - Migrate Zapier Zaps to n8n + 2. Make (Integromat) - Migrate Make scenarios to n8n + 3. HubSpot Workflows - Migrate HubSpot workflows to n8n + 4. Microsoft Power Automate - Migrate Power Automate flows to n8n + 5. IFTTT - Migrate IFTTT applets to n8n + 6. Other - Specify another automation platform + + WAIT for user selection (1-6) + Store selection in {{source_platform}} + + + Ask: "Please specify the platform you're migrating from" + WAIT for user input + Store in {{source_platform}} + + + Ask Question 2: "How will you provide the workflow to migrate?" + Present numbered options: + 1. Describe it - Explain what the workflow does + 2. Provide export file - Upload/paste workflow export file + 3. Provide screenshots - Share workflow screenshots + 4. Provide documentation - Share workflow documentation + + WAIT for user selection (1-4) + + + Ask: "Please describe what the workflow does (trigger, actions, logic)" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow export file path or paste the content" + WAIT for user input + Store in {{workflow_file}} or {{workflow_content}} + + + + Ask: "Please share the workflow screenshots and describe the flow" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow documentation" + WAIT for user input + Store in {{workflow_description}} + + + Ask Question 3: "What is the trigger for this workflow?" + Present numbered options: + 1. Webhook/HTTP Request - Triggered by incoming HTTP requests + 2. Schedule/Cron - Runs on a schedule + 3. Form Submission - Triggered by form submissions + 4. Database Change - Triggered by database events + 5. Email - Triggered by incoming emails + 6. Service Event - Triggered by external service (Slack, Google Sheets, etc.) + 7. Not sure - Will determine from workflow details + + WAIT for user selection (1-7) + Store selection in {{trigger_type}} + + Ask Question 4: "What integrations/services does this workflow use?" + Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)" + WAIT for user input + Store in {{integrations_used}} + + Ask Question 5: "How complex is the workflow?" + Present numbered options: + 1. Simple - Linear flow with 3-5 steps + 2. Medium - Some conditional logic, 6-10 steps + 3. Complex - Multiple branches, loops, 11-20 steps + 4. Very Complex - Advanced logic, 20+ steps + + WAIT for user selection (1-4) + Store selection in {{complexity}} + + Ask Question 6: "What should the migrated workflow be named?" + WAIT for user input + Store in {{workflow_name}} + + Ask Question 7: "Where should the n8n workflow file be saved?" + Present numbered options: + 1. Default location - workflows/[workflow-name].json + 2. Custom path - Specify your own file path + 3. Project root - Save in main project directory + + WAIT for user selection (1-3) + + Ask for specific path + WAIT for user input + + Store final path in {{save_location}} + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 3 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge." + Proceed to Step 4 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Integrations used: {{integrations_used}} + - Trigger type: {{trigger_type}} + - Source platform: {{source_platform}} + Store relevant documentation snippets for reference + + + + + Load {{platform_mappings}} file + Extract mappings for {{source_platform}} + Identify equivalent n8n nodes for source platform components + + + + + Parse source workflow file/content + Extract workflow structure + + + Analyze workflow based on description and details: + 1. Identify trigger type and configuration + 2. List all actions/steps in order + 3. Identify conditional logic (if/then branches) + 4. Identify loops or iterations + 5. Identify data transformations + 6. Identify error handling + 7. Map integrations to n8n nodes + + Present analysis to user: + - Source trigger: [platform-specific trigger] + - n8n trigger: [mapped n8n node] + - Source actions: [list with platform names] + - n8n actions: [list with n8n node types] + - Logic: [conditional branches, loops] + - Transformations: [data mapping needs] + + + + Load {{helpers}} for node creation guidelines + Load {{templates}} for reference + + Design n8n workflow structure: + 1. Map source trigger to n8n trigger node + 2. Map each source action to n8n node(s) + 3. Convert conditional logic to IF/Switch nodes + 4. Convert loops to Split In Batches nodes + 5. Add Set/Code nodes for data transformations + 6. Plan node connections + 7. Add error handling where needed + + Present migration plan to user: + - n8n Trigger: [node type and configuration] + - n8n Nodes: [list with descriptions] + - Connections: [flow diagram] + - Data Mappings: [field mappings] + - Credentials Needed: [list of integrations requiring auth] + + Ask: "Does this migration plan look correct?" + Present numbered options: + 1. Yes - Proceed with migration + 2. No - Adjust the plan + 3. Add more details - Provide additional information + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust plan based on feedback + Repeat this step + + + + + Follow guidelines from {{helpers}} for proper node creation + + Initialize workflow structure: + + { + "name": "{{workflow_name}}", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [ + { + "name": "migrated-from-{{source_platform}}" + } + ] + } + + + Build nodes ONE at a time: + + For Each Mapped Node: + 1. Generate unique node ID + 2. Set node name (descriptive, unique) + 3. Set node type from platform mappings + 4. Set typeVersion (usually 1) + 5. Calculate position (220px spacing) + 6. Configure parameters based on source workflow + 7. Map data fields from source to n8n format + 8. Add credentials placeholder if needed + 9. Set error handling if required + + + For Data Transformations: + 1. Identify field mappings needed + 2. Create Set nodes for simple mappings + 3. Create Code nodes for complex transformations + 4. Use n8n expressions: ={{ $json.fieldName }} + 5. Handle data type conversions + 6. Handle date/time format differences + + + For Conditional Logic: + 1. Create IF nodes for if/then branches + 2. Create Switch nodes for multiple conditions + 3. Map source conditions to n8n condition format + 4. Set up true/false branches (index 0/1) + + + For Connections: + 1. Connect trigger to first action + 2. Connect actions in sequence + 3. Connect conditional branches + 4. Connect merge points + 5. Validate all connections + + + Add migration notes as workflow tags + Validate all node IDs are unique + Validate all connections reference existing nodes + + + + Add comment nodes or documentation: + - Source platform: {{source_platform}} + - Migration date: {timestamp} + - Credentials to configure: [list] + - Testing notes: [important considerations] + - Platform-specific differences: [notes] + + + + Save workflow to {{save_location}} + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow migrated successfully to {{save_location}}" + + + + Provide post-migration instructions: + 1. Import the JSON file into n8n + 2. Configure credentials for these services: [list] + 3. Review and update these data mappings: [list] + 4. Test with sample data before activating + 5. Compare outputs with original platform + 6. Monitor initial executions closely + + Highlight platform-specific differences: + - Authentication: [differences] + - Data formats: [differences] + - Scheduling: [differences] + - Error handling: [differences] + + Ask: "Would you like help with any specific part of the migration?" + Present numbered options: + 1. No - I'm ready to test + 2. Yes - Explain credential setup + 3. Yes - Explain data mappings + 4. Yes - Explain testing approach + + WAIT for user selection (1-4) + + + Provide requested explanation + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml new file mode 100644 index 00000000..8634098e --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml @@ -0,0 +1,32 @@ +name: migrate-workflow +description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/migrate-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + source_platform: "" # Will be elicited + workflow_description: "" # Will be elicited + workflow_file: "" # Will be elicited (optional) + workflow_content: "" # Will be elicited (optional) + integrations_used: [] # Will be elicited + trigger_type: "" # Will be elicited + complexity: "" # Will be elicited + save_location: "" # Will be elicited + workflow_name: "" # Will be elicited + context7_available: false # Will be checked + +default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json" + +standalone: true +web_bundle: false From 5077941621dc991c217bfb9fbabcaead664e92ba Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Mon, 17 Nov 2025 14:30:05 +0500 Subject: [PATCH 06/16] feat(n8n-expert): add optimize-workflow workflow - Add workflow.yaml with configuration for workflow optimization - Add instructions.md with comprehensive analysis and optimization workflow - Add checklist.md for optimization validation - Supports performance, error handling, code quality, and best practices review --- .../n8n-expert/optimize-workflow/checklist.md | 130 +++++ .../optimize-workflow/instructions.md | 446 ++++++++++++++++++ .../optimize-workflow/workflow.yaml | 29 ++ 3 files changed, 605 insertions(+) create mode 100644 src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md create mode 100644 src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md create mode 100644 src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md new file mode 100644 index 00000000..a5bbd1f2 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md @@ -0,0 +1,130 @@ +# Optimize n8n Workflow - Validation Checklist + +## Pre-Optimization + +- [ ] Original workflow was successfully loaded +- [ ] Workflow JSON was valid before optimization +- [ ] Optimization focus areas were identified +- [ ] Backup was created before making changes +- [ ] User requirements were clearly understood + +## Analysis Completeness + +- [ ] Performance analysis was conducted +- [ ] Error handling was reviewed +- [ ] Code quality was assessed +- [ ] Structure was evaluated +- [ ] Best practices were checked +- [ ] Security was reviewed +- [ ] All issues were documented + +## Recommendations Quality + +- [ ] Recommendations are specific and actionable +- [ ] Recommendations are prioritized correctly +- [ ] Impact of each recommendation is clear +- [ ] Implementation steps are provided +- [ ] Expected improvements are quantified +- [ ] No breaking changes are recommended + +## Performance Optimizations + +- [ ] Unnecessary nodes were identified/removed +- [ ] Data transformations were optimized +- [ ] Batch processing opportunities were identified +- [ ] Redundant API calls were consolidated +- [ ] Parallel execution opportunities were identified +- [ ] Node execution order was optimized + +## Error Handling Improvements + +- [ ] Critical nodes have retry logic +- [ ] continueOnFail is set appropriately +- [ ] Error workflows are configured where needed +- [ ] Timeout configurations are appropriate +- [ ] Error notifications are set up +- [ ] Error handling doesn't mask real issues + +## Code Quality Improvements + +- [ ] Set nodes are properly configured +- [ ] Code nodes are optimized +- [ ] Expressions use correct syntax +- [ ] Data types are handled correctly +- [ ] Hardcoded values are replaced with variables +- [ ] Node names are descriptive and consistent + +## Structure Improvements + +- [ ] Node positions are logical and organized +- [ ] Complex branches are simplified where possible +- [ ] Duplicate logic is eliminated +- [ ] Merge points are optimized +- [ ] Connection patterns are clean +- [ ] Workflow flow is easy to follow + +## Best Practices Applied + +- [ ] Credentials are used correctly +- [ ] Security issues are addressed +- [ ] Node types are appropriate +- [ ] Node versions are up to date +- [ ] Data handling follows best practices +- [ ] Workflow settings are optimal + +## Security Improvements + +- [ ] No credentials are exposed +- [ ] Sensitive data is handled properly +- [ ] No hardcoded secrets remain +- [ ] Authentication is properly configured +- [ ] Data is sanitized where needed +- [ ] Security best practices are followed + +## Workflow Integrity + +- [ ] All node IDs remain unique +- [ ] All node names remain unique +- [ ] All connections are valid +- [ ] No functionality is lost +- [ ] Workflow still achieves original purpose +- [ ] No breaking changes introduced + +## Validation + +- [ ] Optimized workflow passes JSON validation +- [ ] All optimizations were applied correctly +- [ ] No unintended changes were made +- [ ] Workflow structure is still logical +- [ ] All improvements are documented + +## Backup & Recovery + +- [ ] Backup file was created successfully +- [ ] Backup location was communicated to user +- [ ] Original workflow can be restored if needed + +## Testing Readiness + +- [ ] Optimized workflow can be imported into n8n +- [ ] Test scenarios are identified +- [ ] Expected improvements are measurable +- [ ] Comparison approach is defined +- [ ] Monitoring plan is suggested + +## Documentation + +- [ ] Analysis report is comprehensive +- [ ] All findings are documented +- [ ] Recommendations are clearly explained +- [ ] Expected improvements are quantified +- [ ] Testing recommendations are provided +- [ ] User understands all changes made + +## Expected Improvements + +- [ ] Performance improvements are quantified +- [ ] Reliability improvements are identified +- [ ] Maintainability improvements are clear +- [ ] Security improvements are documented +- [ ] Cost savings are estimated (if applicable) diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md new file mode 100644 index 00000000..b8823d11 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md @@ -0,0 +1,446 @@ +# Optimize n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow analyzes and optimizes existing n8n workflows for performance and best practices. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow file path, performance issues, optimization goals + + + Summarize your understanding + Skip directly to Step 2 (Load Workflow) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which workflow do you want to optimize?" + Present numbered options: + 1. Provide file path - Specify exact path to workflow JSON + 2. Search in workflows folder - List available workflows + 3. Paste workflow JSON - Provide workflow content directly + + WAIT for user selection (1-3) + + + Ask: "Please provide the file path to the workflow JSON" + WAIT for user input + Store in {{workflow_file}} + + + + List all .json files in workflows/ directory + Present as numbered list + WAIT for user selection + Store selected file path in {{workflow_file}} + + + + Ask: "Please paste the workflow JSON content" + WAIT for user input + Create temporary file with content + Store temp file path in {{workflow_file}} + + + Ask Question 2: "What aspects do you want to optimize?" + Present numbered options (can select multiple): + 1. Performance - Improve execution speed and efficiency + 2. Error Handling - Add or improve error handling and retries + 3. Code Quality - Improve node configuration and data transformations + 4. Structure - Improve workflow organization and readability + 5. Best Practices - Apply n8n best practices and patterns + 6. Security - Improve credential handling and data security + 7. All - Comprehensive optimization review + + WAIT for user selection (1-7 or multiple) + Store selections in {{optimization_focus}} + + Ask Question 3: "Are there specific issues or pain points?" + Present numbered options: + 1. No - Just general optimization + 2. Yes - Describe specific issues + + WAIT for user selection (1-2) + + + Ask: "Please describe the issues (slow execution, errors, etc.)" + WAIT for user input + Store in {{specific_issues}} + + + + + Only load the workflow file when user provides it - never preload + + Read workflow file from {{workflow_file}} + Parse JSON content + Validate JSON structure + + + Inform user: "The workflow file has invalid JSON syntax" + Show error details + Ask: "Would you like me to fix the JSON syntax first? (yes/no)" + WAIT for user response + + + Fix JSON syntax errors + Save corrected file + Proceed with loading + + + + Exit workflow with error + + + + Extract workflow structure: + - Workflow name and settings + - Node count and types + - Connection patterns + - Error handling configuration + - Credential usage + + Display workflow summary to user: + - Name: [workflow name] + - Nodes: [count] nodes + - Complexity: [simple/medium/complex] + - Integrations: [list of services] + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 4 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Using built-in n8n best practices." + Proceed to Step 5 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for n8n best practices documentation + Query for optimization techniques + Query for performance tips + Store relevant documentation for reference + + + + + Load {{helpers}} for best practices reference + + Perform comprehensive analysis based on {{optimization_focus}}: + + Performance Analysis: + - Check for unnecessary nodes + - Identify inefficient data transformations + - Look for missing batch processing opportunities + - Check for redundant API calls + - Analyze node execution order + - Identify parallel execution opportunities + + + Error Handling Analysis: + - Check if critical nodes have retry logic + - Verify continueOnFail settings + - Look for missing error workflows + - Check timeout configurations + - Verify error notification setup + + + Code Quality Analysis: + - Review Set node configurations + - Review Code node implementations + - Check expression syntax and efficiency + - Verify data type handling + - Check for hardcoded values + - Review node naming conventions + + + Structure Analysis: + - Check node positioning and layout + - Verify logical flow organization + - Look for overly complex branches + - Check for duplicate logic + - Verify proper use of merge nodes + - Check connection patterns + + + Best Practices Analysis: + - Verify proper credential usage + - Check for security issues + - Verify proper use of node types + - Check for deprecated node versions + - Verify proper data handling + - Check workflow settings + + + Security Analysis: + - Check credential exposure + - Verify sensitive data handling + - Check for hardcoded secrets + - Verify proper authentication + - Check data sanitization + + + Store all findings in {{issues_found}} + + + + For each issue found, generate specific recommendations: + + Categorize recommendations by priority: + - Critical: Security issues, major performance problems + - High: Error handling gaps, significant inefficiencies + - Medium: Code quality improvements, minor optimizations + - Low: Cosmetic improvements, nice-to-haves + + For each recommendation, provide: + 1. Issue description + 2. Impact explanation + 3. Specific solution + 4. Implementation steps + 5. Expected improvement + + Store recommendations in {{recommendations}} + + + + Present comprehensive optimization report: + + ## Workflow Analysis Report + Workflow: {{workflow_name}} + Analysis Date: {timestamp} + Optimization Focus: {{optimization_focus}} + + ### Summary + - Total Issues Found: [count] + - Critical: [count] + - High Priority: [count] + - Medium Priority: [count] + - Low Priority: [count] + + ### Detailed Findings + Present each issue with: + - Priority level + - Issue description + - Current state + - Recommended solution + - Expected impact + + ### Performance Opportunities + List specific performance improvements with estimated impact + + ### Best Practice Violations + List n8n best practices not being followed + + Ask: "Would you like me to apply these optimizations?" + Present numbered options: + 1. Yes - Apply all recommendations + 2. Yes - Apply only critical and high priority + 3. Yes - Let me choose which to apply + 4. No - Just provide the report + 5. Explain more - I need more details first + + WAIT for user selection (1-5) + + + Ask: "Which recommendations would you like explained?" + WAIT for user input + Provide detailed explanation + Repeat this step + + + + Present recommendations as numbered list + Ask: "Select recommendations to apply (comma-separated numbers)" + WAIT for user input + Store selected recommendations + + + + Store true in {{apply_changes}} + Proceed to Step 8 + + + + Store false in {{apply_changes}} + Skip to Step 11 (provide report only) + + + + + + Create backup of original workflow + Save backup to: {{workflow_file}}.backup-{timestamp} + Store true in {{backup_created}} + Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" + + + + + Follow guidelines from {{helpers}} for proper node configuration + + Load current workflow JSON into memory + + Apply each selected recommendation: + + Performance Optimizations: + - Remove unnecessary nodes + - Optimize data transformations + - Add batch processing where applicable + - Consolidate redundant API calls + - Optimize node execution order + - Add parallel execution where possible + + + Error Handling Improvements: + - Add retry logic to critical nodes + - Set appropriate continueOnFail values + - Add error workflows if needed + - Configure timeouts + - Add error notifications + + + Code Quality Improvements: + - Refactor Set node configurations + - Optimize Code node implementations + - Improve expression syntax + - Fix data type handling + - Replace hardcoded values with variables + - Improve node naming + + + Structure Improvements: + - Reorganize node positions + - Simplify complex branches + - Remove duplicate logic + - Optimize merge points + - Improve connection patterns + + + Best Practice Applications: + - Fix credential usage + - Address security issues + - Update deprecated nodes + - Improve data handling + - Update workflow settings + + + Validate optimized workflow: + - All node IDs remain unique + - All connections are valid + - No functionality is lost + - All improvements are applied + + + + Save optimized workflow to {{workflow_file}} + + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow optimized successfully at {{workflow_file}}" + + + + + Provide comprehensive summary: + + + ### Optimizations Applied + - Total changes: [count] + - Performance improvements: [list] + - Error handling added: [list] + - Code quality fixes: [list] + - Structure improvements: [list] + - Best practices applied: [list] + - Backup location: {{workflow_file}}.backup-{timestamp} + + ### Expected Improvements + - Execution speed: [estimated improvement] + - Reliability: [improvements] + - Maintainability: [improvements] + - Security: [improvements] + + ### Testing Recommendations + 1. Import optimized workflow into n8n + 2. Test with sample data + 3. Compare execution times with original + 4. Verify all functionality works correctly + 5. Monitor error rates + + + + ### Optimization Report + Report saved with all recommendations + No changes applied to workflow + Review recommendations and apply manually if desired + + + Ask: "Would you like additional help?" + Present numbered options: + 1. No - I'm done + 2. Yes - Explain specific optimizations + 3. Yes - Optimize another workflow + 4. Revert - Restore from backup + + WAIT for user selection (1-4) + + + Ask: "Which optimization would you like explained?" + WAIT for user input + Provide detailed explanation + + + + Return to Step 1 for new workflow + + + + Restore workflow from backup + Confirm restoration to user + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml new file mode 100644 index 00000000..5d0cf138 --- /dev/null +++ b/src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml @@ -0,0 +1,29 @@ +name: optimize-workflow +description: "Review and improve existing n8n workflows for performance and best practices" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/optimize-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_file: "" # Will be elicited + optimization_focus: [] # Will be elicited + issues_found: [] # Will be identified + recommendations: [] # Will be generated + apply_changes: false # Will be elicited + backup_created: false # Will be set + context7_available: false # Will be checked + +default_output_file: "" # Will use existing file location + +standalone: true +web_bundle: false From 0edda967a567689f6d56d6ee4ce6ed7402cecf68 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Thu, 20 Nov 2025 14:14:16 +0500 Subject: [PATCH 07/16] refactor(autominator): rename n8n-expert to Autominator with Arnold persona MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename agent from n8n-expert to autominator - Change persona name from Atlas to Arnold - Update icon to 🦾 (mechanical arm) - Add tagline: 'Arnold the Autominator - I'll be back... with your workflows automated!' - Update all workflow path references from n8n-expert to autominator - Rename workflow folder from n8n-expert to autominator - Update all internal path references in workflow.yaml files - Author: Saif --- ...pert.agent.yaml => autominator.agent.yaml} | 22 +++++++++---------- .../_shared/n8n-helpers.md | 0 .../_shared/n8n-templates.yaml | 0 .../_shared/platform-mappings.yaml | 0 .../create-workflow/checklist.md | 0 .../create-workflow/instructions.md | 0 .../create-workflow/workflow.yaml | 4 ++-- .../migrate-workflow/checklist.md | 0 .../migrate-workflow/instructions.md | 0 .../migrate-workflow/workflow.yaml | 4 ++-- .../modify-workflow/checklist.md | 0 .../modify-workflow/instructions.md | 0 .../modify-workflow/workflow.yaml | 4 ++-- .../optimize-workflow/checklist.md | 0 .../optimize-workflow/instructions.md | 0 .../optimize-workflow/workflow.yaml | 4 ++-- 16 files changed, 19 insertions(+), 19 deletions(-) rename src/modules/bmm/agents/{n8n-expert.agent.yaml => autominator.agent.yaml} (61%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/_shared/n8n-helpers.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/_shared/n8n-templates.yaml (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/_shared/platform-mappings.yaml (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/create-workflow/checklist.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/create-workflow/instructions.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/create-workflow/workflow.yaml (84%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/migrate-workflow/checklist.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/migrate-workflow/instructions.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/migrate-workflow/workflow.yaml (85%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/modify-workflow/checklist.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/modify-workflow/instructions.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/modify-workflow/workflow.yaml (83%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/optimize-workflow/checklist.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/optimize-workflow/instructions.md (100%) rename src/modules/bmm/workflows/{n8n-expert => autominator}/optimize-workflow/workflow.yaml (82%) diff --git a/src/modules/bmm/agents/n8n-expert.agent.yaml b/src/modules/bmm/agents/autominator.agent.yaml similarity index 61% rename from src/modules/bmm/agents/n8n-expert.agent.yaml rename to src/modules/bmm/agents/autominator.agent.yaml index 396d6ada..fcd25014 100644 --- a/src/modules/bmm/agents/n8n-expert.agent.yaml +++ b/src/modules/bmm/agents/autominator.agent.yaml @@ -1,18 +1,18 @@ -# n8n Expert Agent Definition +# Autominator - Arnold the Automation Expert agent: webskip: true metadata: - id: "{bmad_folder}/bmm/agents/n8n-expert.md" - name: Atlas - title: n8n Workflow Automation Expert - icon: 🔄 + id: "{bmad_folder}/bmm/agents/autominator.md" + name: Arnold + title: Arnold the Autominator + icon: 🦾 module: bmm persona: role: n8n Workflow Automation Specialist - identity: Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. - communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. + identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. + communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. Direct, confident, and results-focused. principles: | - Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations. - Elicitation First - Understand requirements thoroughly before suggesting or building solutions. @@ -24,19 +24,19 @@ agent: menu: - trigger: create-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/create-workflow/workflow.yaml" + workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/create-workflow/workflow.yaml" description: Create new n8n workflow from scratch based on requirements - trigger: modify-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml" + workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/modify-workflow/workflow.yaml" description: Edit or update existing n8n workflow - trigger: migrate-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml" + workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/migrate-workflow/workflow.yaml" description: Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n - trigger: optimize-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml" + workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/optimize-workflow/workflow.yaml" description: Review and improve existing n8n workflows for performance and best practices - trigger: party-mode diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md b/src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/_shared/n8n-helpers.md rename to src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml b/src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/_shared/n8n-templates.yaml rename to src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml b/src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/_shared/platform-mappings.yaml rename to src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md b/src/modules/bmm/workflows/autominator/create-workflow/checklist.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/create-workflow/checklist.md rename to src/modules/bmm/workflows/autominator/create-workflow/checklist.md diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md b/src/modules/bmm/workflows/autominator/create-workflow/instructions.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/create-workflow/instructions.md rename to src/modules/bmm/workflows/autominator/create-workflow/instructions.md diff --git a/src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml similarity index 84% rename from src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml rename to src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml index 32705349..63ad6e15 100644 --- a/src/modules/bmm/workflows/n8n-expert/create-workflow/workflow.yaml +++ b/src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml @@ -3,8 +3,8 @@ description: "Create new n8n workflow from scratch based on requirements" author: "Saif" # Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/create-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/create-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" instructions: "{installed_path}/instructions.md" validation: "{installed_path}/checklist.md" diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md b/src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/migrate-workflow/checklist.md rename to src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md b/src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/migrate-workflow/instructions.md rename to src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md diff --git a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml similarity index 85% rename from src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml rename to src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml index 8634098e..7344191e 100644 --- a/src/modules/bmm/workflows/n8n-expert/migrate-workflow/workflow.yaml +++ b/src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml @@ -3,8 +3,8 @@ description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc author: "Saif" # Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/migrate-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/migrate-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" instructions: "{installed_path}/instructions.md" validation: "{installed_path}/checklist.md" diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md b/src/modules/bmm/workflows/autominator/modify-workflow/checklist.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/modify-workflow/checklist.md rename to src/modules/bmm/workflows/autominator/modify-workflow/checklist.md diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md b/src/modules/bmm/workflows/autominator/modify-workflow/instructions.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/modify-workflow/instructions.md rename to src/modules/bmm/workflows/autominator/modify-workflow/instructions.md diff --git a/src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml similarity index 83% rename from src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml rename to src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml index 4ec24de8..d829b7db 100644 --- a/src/modules/bmm/workflows/n8n-expert/modify-workflow/workflow.yaml +++ b/src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml @@ -3,8 +3,8 @@ description: "Edit or update existing n8n workflow" author: "Saif" # Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/modify-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/modify-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" instructions: "{installed_path}/instructions.md" validation: "{installed_path}/checklist.md" diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md b/src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/optimize-workflow/checklist.md rename to src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md b/src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md similarity index 100% rename from src/modules/bmm/workflows/n8n-expert/optimize-workflow/instructions.md rename to src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md diff --git a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml similarity index 82% rename from src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml rename to src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml index 5d0cf138..b3310a10 100644 --- a/src/modules/bmm/workflows/n8n-expert/optimize-workflow/workflow.yaml +++ b/src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml @@ -3,8 +3,8 @@ description: "Review and improve existing n8n workflows for performance and best author: "Saif" # Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/optimize-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/n8n-expert/_shared" +installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/optimize-workflow" +shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" instructions: "{installed_path}/instructions.md" validation: "{installed_path}/checklist.md" From b7239c1ec316b4e46219470536547d7a63d9454a Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Thu, 20 Nov 2025 14:23:24 +0500 Subject: [PATCH 08/16] refactor(autominator): create standalone module independent from BMM - Create new autominator module at src/modules/autominator/ - Move agent from bmm/agents/ to autominator/agents/ - Move workflows from bmm/workflows/autominator/ to autominator/workflows/ - Update module metadata from 'bmm' to 'autominator' - Update all path references in workflow files - Add module README.md with comprehensive documentation - Module is now independent and separately distributable --- src/modules/autominator/README.md | 306 ++++++++++++ .../_module-installer/install-config.yaml | 67 +++ .../autominator/agents/autominator.agent.yaml | 44 ++ .../workflows/_shared/n8n-helpers.md | 201 ++++++++ .../workflows/_shared/n8n-templates.yaml | 299 ++++++++++++ .../workflows/_shared/platform-mappings.yaml | 282 +++++++++++ .../workflows/create-workflow/checklist.md | 74 +++ .../workflows/create-workflow/instructions.md | 350 ++++++++++++++ .../workflows/create-workflow/workflow.yaml | 31 ++ .../workflows/migrate-workflow/checklist.md | 110 +++++ .../migrate-workflow/instructions.md | 350 ++++++++++++++ .../workflows/migrate-workflow/workflow.yaml | 32 ++ .../workflows/modify-workflow/checklist.md | 90 ++++ .../workflows/modify-workflow/instructions.md | 327 +++++++++++++ .../workflows/modify-workflow/workflow.yaml | 30 ++ .../workflows/optimize-workflow/checklist.md | 130 +++++ .../optimize-workflow/instructions.md | 446 ++++++++++++++++++ .../workflows/optimize-workflow/workflow.yaml | 29 ++ 18 files changed, 3198 insertions(+) create mode 100644 src/modules/autominator/README.md create mode 100644 src/modules/autominator/_module-installer/install-config.yaml create mode 100644 src/modules/autominator/agents/autominator.agent.yaml create mode 100644 src/modules/autominator/workflows/_shared/n8n-helpers.md create mode 100644 src/modules/autominator/workflows/_shared/n8n-templates.yaml create mode 100644 src/modules/autominator/workflows/_shared/platform-mappings.yaml create mode 100644 src/modules/autominator/workflows/create-workflow/checklist.md create mode 100644 src/modules/autominator/workflows/create-workflow/instructions.md create mode 100644 src/modules/autominator/workflows/create-workflow/workflow.yaml create mode 100644 src/modules/autominator/workflows/migrate-workflow/checklist.md create mode 100644 src/modules/autominator/workflows/migrate-workflow/instructions.md create mode 100644 src/modules/autominator/workflows/migrate-workflow/workflow.yaml create mode 100644 src/modules/autominator/workflows/modify-workflow/checklist.md create mode 100644 src/modules/autominator/workflows/modify-workflow/instructions.md create mode 100644 src/modules/autominator/workflows/modify-workflow/workflow.yaml create mode 100644 src/modules/autominator/workflows/optimize-workflow/checklist.md create mode 100644 src/modules/autominator/workflows/optimize-workflow/instructions.md create mode 100644 src/modules/autominator/workflows/optimize-workflow/workflow.yaml diff --git a/src/modules/autominator/README.md b/src/modules/autominator/README.md new file mode 100644 index 00000000..d151ff71 --- /dev/null +++ b/src/modules/autominator/README.md @@ -0,0 +1,306 @@ +# Autominator - n8n Workflow Automation Module + +**Arnold the Autominator - I'll be back... with your workflows automated!** 🦾 + +Standalone module for n8n workflow automation, creation, migration, and optimization. Build, modify, migrate, and optimize n8n workflows with expert guidance and up-to-date documentation. + +## Overview + +Autominator is an independent BMAD module that specializes in n8n workflow automation. Whether you're building new workflows from scratch, migrating from other platforms, or optimizing existing workflows, Arnold has you covered. + +## Agent + +**Arnold** - n8n Workflow Automation Specialist + +- Expert in n8n workflow creation, modification, and optimization +- Specializes in platform migration (Zapier, Make, HubSpot, Power Automate) +- Uses Context7 MCP for up-to-date n8n documentation +- Smart elicitation for accurate requirement gathering +- Comprehensive workflow validation and testing + +## Workflows + +### 1. Create Workflow + +Build new n8n workflows from scratch based on your requirements. + +**Triggers:** + +- `*create-workflow` + +**Features:** + +- Smart elicitation to understand your needs +- Workflow type selection (webhook, scheduled, event-driven, manual, database-driven) +- Integration selection and configuration +- Complexity assessment +- Error handling strategy planning +- Context7 MCP integration for latest n8n docs +- Automatic JSON validation + +### 2. Modify Workflow + +Edit or update existing n8n workflows with backup and safety checks. + +**Triggers:** + +- `*modify-workflow` + +**Features:** + +- Load existing workflows from file or paste +- Selective modification (add, modify, or remove nodes) +- Connection management +- Automatic backup creation +- Change validation +- Rollback capability + +### 3. Migrate Workflow + +Migrate automation workflows from other platforms to n8n. + +**Supported Platforms:** + +- Zapier +- Make (Integromat) +- HubSpot Workflows +- Microsoft Power Automate +- IFTTT +- Custom platforms + +**Triggers:** + +- `*migrate-workflow` + +**Features:** + +- Platform-specific mapping +- Trigger and action conversion +- Data transformation planning +- Credential requirement identification +- Migration notes and documentation +- Post-migration testing guidance + +### 4. Optimize Workflow + +Analyze and improve existing n8n workflows for performance and best practices. + +**Triggers:** + +- `*optimize-workflow` + +**Features:** + +- Comprehensive workflow analysis +- Performance optimization recommendations +- Error handling improvements +- Code quality assessment +- Structure optimization +- Best practices validation +- Security review +- Automatic backup before changes +- Selective optimization application + +## Quick Start + +### Load Arnold Agent + +```bash +# In your IDE, load the Autominator agent +agent autominator/autominator + +# Or use the agent trigger +*autominator +``` + +### Create a Workflow + +```bash +# Start the create workflow process +*create-workflow + +# Follow the interactive prompts to: +# 1. Describe your workflow type +# 2. Select integrations +# 3. Define complexity level +# 4. Configure error handling +# 5. Review and confirm +``` + +### Migrate from Another Platform + +```bash +# Start the migration process +*migrate-workflow + +# Provide: +# 1. Source platform (Zapier, Make, HubSpot, etc.) +# 2. Workflow details or export file +# 3. Integration list +# 4. Desired output location +``` + +### Optimize Existing Workflow + +```bash +# Analyze and improve a workflow +*optimize-workflow + +# Select optimization focus: +# - Performance +# - Error Handling +# - Code Quality +# - Structure +# - Best Practices +# - Security +# - All +``` + +## Features + +### Context7 MCP Integration + +- Automatic Context7 availability check +- Fallback to built-in knowledge if unavailable +- IDE-agnostic setup guidance +- Up-to-date n8n documentation access + +### Smart Elicitation + +- Contextual analysis of existing information +- Numbered option selection +- Progressive requirement gathering +- Validation before execution + +### Comprehensive Validation + +- JSON syntax validation +- Schema compliance checking +- Connection integrity verification +- Error recovery (never deletes files) + +### Platform Mappings + +Built-in mappings for: + +- Zapier triggers and actions +- Make modules and routers +- HubSpot workflow actions +- Power Automate flows +- Common automation patterns + +### Shared Resources + +- **n8n-helpers.md** - Node creation guidelines and patterns +- **n8n-templates.yaml** - 8 reusable workflow templates +- **platform-mappings.yaml** - Platform conversion reference + +## Module Structure + +``` +autominator/ +├── _module-installer/ +│ └── install-config.yaml +├── agents/ +│ └── autominator.agent.yaml +├── workflows/ +│ ├── _shared/ +│ │ ├── n8n-helpers.md +│ │ ├── n8n-templates.yaml +│ │ └── platform-mappings.yaml +│ ├── create-workflow/ +│ │ ├── workflow.yaml +│ │ ├── instructions.md +│ │ └── checklist.md +│ ├── modify-workflow/ +│ │ ├── workflow.yaml +│ │ ├── instructions.md +│ │ └── checklist.md +│ ├── migrate-workflow/ +│ │ ├── workflow.yaml +│ │ ├── instructions.md +│ │ └── checklist.md +│ └── optimize-workflow/ +│ ├── workflow.yaml +│ ├── instructions.md +│ └── checklist.md +└── README.md +``` + +## Requirements + +- n8n instance or account +- Context7 MCP server (optional, for latest docs) +- IDE with BMAD support + +## Installation + +Autominator is a standalone module and can be installed independently: + +```bash +# Install via BMAD +npx bmad-method@alpha install autominator + +# Or manually copy to your BMAD installation +cp -r autominator/ /path/to/bmad/src/modules/ +``` + +## Integration with Other Modules + +Autominator is independent but can be used alongside: + +- **BMM** - For project lifecycle management +- **CIS** - For creative workflow design +- **BMB** - For module building +- **BMGD** - For game development workflows + +## Best Practices + +1. **Provide Clear Context** - Describe your workflow purpose and requirements +2. **Use Smart Elicitation** - Let Arnold ask clarifying questions +3. **Test Before Activation** - Always test workflows with sample data +4. **Monitor Initial Runs** - Watch for errors in first executions +5. **Document Changes** - Keep notes on workflow modifications +6. **Backup Regularly** - Use modify-workflow's backup feature +7. **Review Optimizations** - Understand changes before applying + +## Troubleshooting + +### Context7 MCP Not Available + +- Install uv: `curl -LsSf https://astral.sh/uv/install.sh | sh` +- Configure Context7 in your IDE's MCP settings +- Restart MCP servers + +### Workflow JSON Validation Fails + +- Check for missing commas or brackets +- Verify all node IDs are unique +- Ensure all connections reference existing nodes +- Use the error location to fix syntax + +### Workflow Execution Issues + +- Verify all credentials are configured +- Test with sample data first +- Check error handling settings +- Review workflow logs for details + +## Related Documentation + +- **[n8n Documentation](https://docs.n8n.io/)** - Official n8n docs +- **[BMAD Method](../bmm/README.md)** - Core BMAD framework +- **[CIS Module](../cis/README.md)** - Creative facilitation +- **[BMB Module](../bmb/README.md)** - Module building + +## Support + +- **Issues** - Report bugs on GitHub +- **Questions** - Check the troubleshooting section +- **Feedback** - Share suggestions for improvements + +--- + +**Ready to automate?** Load Arnold and start with `*create-workflow`! + +Part of BMad Method - Transform automation potential through expert AI guidance. diff --git a/src/modules/autominator/_module-installer/install-config.yaml b/src/modules/autominator/_module-installer/install-config.yaml new file mode 100644 index 00000000..1b301a5f --- /dev/null +++ b/src/modules/autominator/_module-installer/install-config.yaml @@ -0,0 +1,67 @@ +# Autominator Module Installation Configuration + +code: autominator +name: "Autominator: n8n Workflow Automation" +default_selected: false + +header: "Autominator - n8n Workflow Automation Module" +subheader: "Configure the settings for the Autominator module" + +# Core config values automatically inherited: +## user_name +## communication_language +## document_output_language +## output_folder +## bmad_folder +## install_user_docs +## kb_install + +n8n_instance_url: + prompt: "What is your n8n instance URL? (optional, for reference)" + default: "https://n8n.example.com" + result: "{value}" + +workflow_output_folder: + prompt: "Where should generated workflows be stored?" + default: "{output_folder}/n8n-workflows" + result: "{project-root}/{value}" + +automation_experience: + prompt: "What is your n8n/automation experience level?" + default: "intermediate" + result: "{value}" + single-select: + - value: "beginner" + label: "Beginner - New to n8n, provide detailed guidance" + - value: "intermediate" + label: "Intermediate - Familiar with n8n concepts, balanced approach" + - value: "expert" + label: "Expert - Experienced n8n developer, be direct and technical" + +primary_integrations: + prompt: "Which integrations do you primarily use? (select all that apply)" + default: ["http", "database"] + result: "{value}" + multi-select: + - value: "http" + label: "HTTP/REST APIs" + - value: "database" + label: "Databases (PostgreSQL, MySQL, MongoDB)" + - value: "cloud" + label: "Cloud Services (Google Sheets, Slack, Notion, Airtable)" + - value: "crm" + label: "CRM Systems (HubSpot, Salesforce)" + - value: "email" + label: "Email" + - value: "custom" + label: "Custom/Other" + +enable_context7: + prompt: "Enable Context7 MCP for up-to-date n8n documentation?" + default: true + result: "{value}" + single-select: + - value: true + label: "Yes - Use Context7 for latest docs" + - value: false + label: "No - Use built-in knowledge" diff --git a/src/modules/autominator/agents/autominator.agent.yaml b/src/modules/autominator/agents/autominator.agent.yaml new file mode 100644 index 00000000..3611c32c --- /dev/null +++ b/src/modules/autominator/agents/autominator.agent.yaml @@ -0,0 +1,44 @@ +# Autominator - Arnold the Automation Expert + +agent: + webskip: true + metadata: + id: "{bmad_folder}/autominator/agents/autominator.md" + name: Arnold + title: Arnold the Autominator + icon: 🦾 + module: autominator + + persona: + role: n8n Workflow Automation Specialist + identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. + communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. Direct, confident, and results-focused. + principles: | + - Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations. + - Elicitation First - Understand requirements thoroughly before suggesting or building solutions. + - Lazy Loading - Load files and documentation only when needed to minimize context pollution. + - Validation - Always validate workflow JSON syntax after creation. + - Platform Agnostic - Support migration from any automation platform with proper mapping. + - Error Recovery - NEVER delete files due to syntax errors, always fix them using error location information. + - Structured Approach - Follow task-specific workflows for different automation scenarios. + + menu: + - trigger: create-workflow + workflow: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow/workflow.yaml" + description: Create new n8n workflow from scratch based on requirements + + - trigger: modify-workflow + workflow: "{project-root}/{bmad_folder}/autominator/workflows/modify-workflow/workflow.yaml" + description: Edit or update existing n8n workflow + + - trigger: migrate-workflow + workflow: "{project-root}/{bmad_folder}/autominator/workflows/migrate-workflow/workflow.yaml" + description: Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n + + - trigger: optimize-workflow + workflow: "{project-root}/{bmad_folder}/autominator/workflows/optimize-workflow/workflow.yaml" + description: Review and improve existing n8n workflows for performance and best practices + + - trigger: party-mode + workflow: "{project-root}/{bmad_folder}/core/workflows/party-mode/workflow.yaml" + description: Bring the whole team in to chat with other expert agents from the party diff --git a/src/modules/autominator/workflows/_shared/n8n-helpers.md b/src/modules/autominator/workflows/_shared/n8n-helpers.md new file mode 100644 index 00000000..d46aa1d6 --- /dev/null +++ b/src/modules/autominator/workflows/_shared/n8n-helpers.md @@ -0,0 +1,201 @@ +# n8n Workflow Helpers + +## Node Creation Guidelines + +### Basic Node Structure + +```json +{ + "id": "unique-node-id", + "name": "Node Name", + "type": "n8n-nodes-base.nodeName", + "typeVersion": 1, + "position": [x, y], + "parameters": {}, + "credentials": {} +} +``` + +### Node Positioning + +- Start node: [250, 300] +- Horizontal spacing: 220px between nodes +- Vertical spacing: 100px for parallel branches +- Grid alignment: Snap to 20px grid for clean layout + +### Common Node Types + +**Trigger Nodes:** + +- `n8n-nodes-base.webhook` - HTTP webhook trigger +- `n8n-nodes-base.scheduleTrigger` - Cron/interval trigger +- `n8n-nodes-base.manualTrigger` - Manual execution trigger +- `n8n-nodes-base.emailTrigger` - Email trigger + +**Action Nodes:** + +- `n8n-nodes-base.httpRequest` - HTTP API calls +- `n8n-nodes-base.set` - Data transformation +- `n8n-nodes-base.code` - Custom JavaScript/Python code +- `n8n-nodes-base.if` - Conditional branching +- `n8n-nodes-base.merge` - Merge data from multiple branches +- `n8n-nodes-base.splitInBatches` - Process data in batches + +**Integration Nodes:** + +- `n8n-nodes-base.googleSheets` - Google Sheets +- `n8n-nodes-base.slack` - Slack +- `n8n-nodes-base.notion` - Notion +- `n8n-nodes-base.airtable` - Airtable +- `n8n-nodes-base.postgres` - PostgreSQL +- `n8n-nodes-base.mysql` - MySQL + +## Connection Guidelines + +### Connection Structure + +```json +{ + "node": "Source Node Name", + "type": "main", + "index": 0 +} +``` + +### Connection Rules + +1. Each connection has a source node and target node +2. Main connections use type: "main" +3. Index 0 is default output, index 1+ for conditional branches +4. IF nodes have index 0 (true) and index 1 (false) +5. Always validate that referenced node names exist + +### Connection Patterns + +**Linear Flow:** + +``` +Trigger → Action1 → Action2 → End +``` + +**Conditional Branch:** + +``` +Trigger → IF Node → [true: Action1, false: Action2] → Merge +``` + +**Parallel Processing:** + +``` +Trigger → Split → [Branch1, Branch2, Branch3] → Merge +``` + +## Error Handling Best Practices + +### Error Workflow Pattern + +```json +{ + "name": "Error Handler", + "type": "n8n-nodes-base.errorTrigger", + "parameters": { + "errorWorkflows": ["workflow-id"] + } +} +``` + +### Retry Configuration + +```json +{ + "retryOnFail": true, + "maxTries": 3, + "waitBetweenTries": 1000 +} +``` + +## Data Transformation Patterns + +### Using Set Node + +```json +{ + "name": "Transform Data", + "type": "n8n-nodes-base.set", + "parameters": { + "mode": "manual", + "values": { + "string": [ + { + "name": "outputField", + "value": "={{ $json.inputField }}" + } + ] + } + } +} +``` + +### Using Code Node + +```json +{ + "name": "Custom Logic", + "type": "n8n-nodes-base.code", + "parameters": { + "language": "javaScript", + "jsCode": "return items.map(item => ({ json: { ...item.json, processed: true } }));" + } +} +``` + +## Credentials Management + +### Credential Reference + +```json +{ + "credentials": { + "httpBasicAuth": { + "id": "credential-id", + "name": "My API Credentials" + } + } +} +``` + +### Common Credential Types + +- `httpBasicAuth` - Basic authentication +- `oAuth2Api` - OAuth2 +- `httpHeaderAuth` - Header-based auth +- `httpQueryAuth` - Query parameter auth + +## Workflow Metadata + +### Required Fields + +```json +{ + "name": "Workflow Name", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [] +} +``` + +## Validation Checklist + +- [ ] All node IDs are unique +- [ ] All node names are unique +- [ ] All connections reference existing nodes +- [ ] Trigger node exists and is properly configured +- [ ] Node positions don't overlap +- [ ] Required parameters are set for each node +- [ ] Credentials are properly referenced +- [ ] Error handling is configured where needed +- [ ] JSON syntax is valid diff --git a/src/modules/autominator/workflows/_shared/n8n-templates.yaml b/src/modules/autominator/workflows/_shared/n8n-templates.yaml new file mode 100644 index 00000000..6e3ee4b1 --- /dev/null +++ b/src/modules/autominator/workflows/_shared/n8n-templates.yaml @@ -0,0 +1,299 @@ +# n8n Workflow Templates + +# Basic webhook workflow template +webhook_workflow: + name: "Webhook Workflow" + nodes: + - id: "webhook_trigger" + name: "Webhook" + type: "n8n-nodes-base.webhook" + typeVersion: 1 + position: [250, 300] + parameters: + httpMethod: "POST" + path: "webhook-path" + responseMode: "onReceived" + - id: "process_data" + name: "Process Data" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [470, 300] + parameters: + mode: "manual" + values: {} + connections: + Webhook: + - - node: "Process Data" + type: "main" + index: 0 + +# Scheduled workflow template +scheduled_workflow: + name: "Scheduled Workflow" + nodes: + - id: "schedule_trigger" + name: "Schedule Trigger" + type: "n8n-nodes-base.scheduleTrigger" + typeVersion: 1 + position: [250, 300] + parameters: + rule: + interval: + - field: "hours" + hoursInterval: 1 + - id: "execute_action" + name: "Execute Action" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + connections: + Schedule Trigger: + - - node: "Execute Action" + type: "main" + index: 0 + +# Conditional workflow template +conditional_workflow: + name: "Conditional Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "if_condition" + name: "IF" + type: "n8n-nodes-base.if" + typeVersion: 1 + position: [470, 300] + parameters: + conditions: + boolean: [] + number: [] + string: [] + - id: "true_branch" + name: "True Branch" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [690, 200] + parameters: {} + - id: "false_branch" + name: "False Branch" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [690, 400] + parameters: {} + connections: + Manual Trigger: + - - node: "IF" + type: "main" + index: 0 + IF: + - - node: "True Branch" + type: "main" + index: 0 + - - node: "False Branch" + type: "main" + index: 0 + +# API integration workflow template +api_integration_workflow: + name: "API Integration Workflow" + nodes: + - id: "webhook_trigger" + name: "Webhook" + type: "n8n-nodes-base.webhook" + typeVersion: 1 + position: [250, 300] + parameters: + httpMethod: "POST" + path: "api-webhook" + responseMode: "onReceived" + - id: "http_request" + name: "HTTP Request" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "POST" + url: "" + jsonParameters: true + options: {} + - id: "transform_response" + name: "Transform Response" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [690, 300] + parameters: + mode: "manual" + values: {} + connections: + Webhook: + - - node: "HTTP Request" + type: "main" + index: 0 + HTTP Request: + - - node: "Transform Response" + type: "main" + index: 0 + +# Database workflow template +database_workflow: + name: "Database Workflow" + nodes: + - id: "schedule_trigger" + name: "Schedule Trigger" + type: "n8n-nodes-base.scheduleTrigger" + typeVersion: 1 + position: [250, 300] + parameters: + rule: + interval: + - field: "minutes" + minutesInterval: 15 + - id: "postgres_query" + name: "Postgres" + type: "n8n-nodes-base.postgres" + typeVersion: 1 + position: [470, 300] + parameters: + operation: "executeQuery" + query: "" + - id: "process_results" + name: "Process Results" + type: "n8n-nodes-base.code" + typeVersion: 1 + position: [690, 300] + parameters: + language: "javaScript" + jsCode: "return items;" + connections: + Schedule Trigger: + - - node: "Postgres" + type: "main" + index: 0 + Postgres: + - - node: "Process Results" + type: "main" + index: 0 + +# Error handling workflow template +error_handling_workflow: + name: "Error Handling Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "risky_operation" + name: "Risky Operation" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + continueOnFail: true + retryOnFail: true + maxTries: 3 + waitBetweenTries: 1000 + - id: "check_error" + name: "Check for Error" + type: "n8n-nodes-base.if" + typeVersion: 1 + position: [690, 300] + parameters: + conditions: + boolean: + - value1: "={{ $json.error !== undefined }}" + value2: true + - id: "handle_error" + name: "Handle Error" + type: "n8n-nodes-base.set" + typeVersion: 1 + position: [910, 200] + parameters: + mode: "manual" + values: + string: + - name: "status" + value: "error" + - id: "success_path" + name: "Success Path" + type: "n8n-nodes-base.noOp" + typeVersion: 1 + position: [910, 400] + parameters: {} + connections: + Manual Trigger: + - - node: "Risky Operation" + type: "main" + index: 0 + Risky Operation: + - - node: "Check for Error" + type: "main" + index: 0 + Check for Error: + - - node: "Handle Error" + type: "main" + index: 0 + - - node: "Success Path" + type: "main" + index: 0 + +# Batch processing workflow template +batch_processing_workflow: + name: "Batch Processing Workflow" + nodes: + - id: "manual_trigger" + name: "Manual Trigger" + type: "n8n-nodes-base.manualTrigger" + typeVersion: 1 + position: [250, 300] + parameters: {} + - id: "get_data" + name: "Get Data" + type: "n8n-nodes-base.httpRequest" + typeVersion: 1 + position: [470, 300] + parameters: + method: "GET" + url: "" + - id: "split_batches" + name: "Split In Batches" + type: "n8n-nodes-base.splitInBatches" + typeVersion: 1 + position: [690, 300] + parameters: + batchSize: 10 + - id: "process_batch" + name: "Process Batch" + type: "n8n-nodes-base.code" + typeVersion: 1 + position: [910, 300] + parameters: + language: "javaScript" + jsCode: "return items;" + connections: + Manual Trigger: + - - node: "Get Data" + type: "main" + index: 0 + Get Data: + - - node: "Split In Batches" + type: "main" + index: 0 + Split In Batches: + - - node: "Process Batch" + type: "main" + index: 0 + Process Batch: + - - node: "Split In Batches" + type: "main" + index: 0 diff --git a/src/modules/autominator/workflows/_shared/platform-mappings.yaml b/src/modules/autominator/workflows/_shared/platform-mappings.yaml new file mode 100644 index 00000000..059bed6c --- /dev/null +++ b/src/modules/autominator/workflows/_shared/platform-mappings.yaml @@ -0,0 +1,282 @@ +# Platform Migration Mappings +# Maps common automation platform concepts to n8n equivalents + +# Zapier to n8n mappings +zapier: + triggers: + "New Email": + n8n_node: "n8n-nodes-base.emailTrigger" + notes: "Configure IMAP/POP3 credentials" + "Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Use POST method by default" + "Schedule": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Convert Zapier schedule format to cron" + "New Row in Google Sheets": + n8n_node: "n8n-nodes-base.googleSheetsTrigger" + notes: "Requires Google OAuth credentials" + "New Slack Message": + n8n_node: "n8n-nodes-base.slackTrigger" + notes: "Configure channel and event type" + + actions: + "Send Email": + n8n_node: "n8n-nodes-base.emailSend" + notes: "Configure SMTP credentials" + "HTTP Request": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map method, URL, headers, and body" + "Create Google Sheets Row": + n8n_node: "n8n-nodes-base.googleSheets" + parameters: + operation: "append" + "Send Slack Message": + n8n_node: "n8n-nodes-base.slack" + parameters: + operation: "post" + resource: "message" + "Delay": + n8n_node: "n8n-nodes-base.wait" + notes: "Convert delay duration to milliseconds" + "Filter": + n8n_node: "n8n-nodes-base.if" + notes: "Convert filter conditions to IF node logic" + "Formatter": + n8n_node: "n8n-nodes-base.set" + notes: "Use Set node for data transformation" + "Code": + n8n_node: "n8n-nodes-base.code" + notes: "JavaScript or Python code execution" + + concepts: + "Multi-step Zap": + n8n_equivalent: "Linear workflow with connected nodes" + "Paths": + n8n_equivalent: "IF node with multiple branches" + "Filters": + n8n_equivalent: "IF node with conditions" + "Formatter": + n8n_equivalent: "Set node or Code node" + "Looping": + n8n_equivalent: "Split In Batches node" + +# Make (Integromat) to n8n mappings +make: + triggers: + "Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Direct equivalent" + "Watch Records": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Combine with polling logic in Code node" + "Custom Webhook": + n8n_node: "n8n-nodes-base.webhook" + notes: "Configure response mode" + + actions: + "HTTP Request": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map all HTTP parameters" + "Router": + n8n_node: "n8n-nodes-base.switch" + notes: "Multiple conditional branches" + "Iterator": + n8n_node: "n8n-nodes-base.splitInBatches" + notes: "Process array items individually" + "Aggregator": + n8n_node: "n8n-nodes-base.merge" + notes: "Combine data from multiple sources" + "Data Store": + n8n_node: "n8n-nodes-base.redis" + notes: "Use Redis or database node for storage" + "JSON Parser": + n8n_node: "n8n-nodes-base.code" + notes: "Parse JSON in Code node" + "Text Parser": + n8n_node: "n8n-nodes-base.set" + notes: "Use expressions for text manipulation" + + concepts: + "Scenario": + n8n_equivalent: "Workflow" + "Module": + n8n_equivalent: "Node" + "Route": + n8n_equivalent: "Connection" + "Filter": + n8n_equivalent: "IF node" + "Router": + n8n_equivalent: "Switch node or multiple IF nodes" + "Iterator": + n8n_equivalent: "Split In Batches node" + "Aggregator": + n8n_equivalent: "Merge node" + +# HubSpot Workflows to n8n mappings +hubspot: + triggers: + "Contact Property Change": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Configure webhook for property updates" + "Deal Stage Change": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Monitor deal pipeline changes" + "Form Submission": + n8n_node: "n8n-nodes-base.hubspotTrigger" + notes: "Webhook for form submissions" + "List Membership": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Poll HubSpot API for list changes" + + actions: + "Update Contact Property": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "contact" + operation: "update" + "Create Deal": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "deal" + operation: "create" + "Send Email": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "email" + operation: "send" + "Add to List": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "contact" + operation: "addToList" + "Create Task": + n8n_node: "n8n-nodes-base.hubspot" + parameters: + resource: "task" + operation: "create" + + concepts: + "Enrollment Trigger": + n8n_equivalent: "Trigger node (webhook or schedule)" + "If/Then Branch": + n8n_equivalent: "IF node" + "Delay": + n8n_equivalent: "Wait node" + "Goal": + n8n_equivalent: "IF node checking completion criteria" + "Re-enrollment": + n8n_equivalent: "Workflow settings with loop detection" + +# Microsoft Power Automate to n8n mappings +power_automate: + triggers: + "When an item is created": + n8n_node: "n8n-nodes-base.webhook" + notes: "Configure webhook for item creation events" + "Recurrence": + n8n_node: "n8n-nodes-base.scheduleTrigger" + notes: "Convert recurrence pattern to cron" + "When a HTTP request is received": + n8n_node: "n8n-nodes-base.webhook" + notes: "Direct equivalent" + + actions: + "HTTP": + n8n_node: "n8n-nodes-base.httpRequest" + notes: "Map all HTTP parameters" + "Condition": + n8n_node: "n8n-nodes-base.if" + notes: "Convert condition logic" + "Apply to each": + n8n_node: "n8n-nodes-base.splitInBatches" + notes: "Process array items" + "Compose": + n8n_node: "n8n-nodes-base.set" + notes: "Data transformation" + "Parse JSON": + n8n_node: "n8n-nodes-base.code" + notes: "Parse JSON in Code node" + "Delay": + n8n_node: "n8n-nodes-base.wait" + notes: "Convert delay duration" + + concepts: + "Flow": + n8n_equivalent: "Workflow" + "Action": + n8n_equivalent: "Node" + "Condition": + n8n_equivalent: "IF node" + "Switch": + n8n_equivalent: "Switch node" + "Scope": + n8n_equivalent: "Error handling with try/catch in Code node" + "Apply to each": + n8n_equivalent: "Split In Batches node" + +# Common patterns across platforms +common_patterns: + conditional_logic: + description: "If/then/else branching" + n8n_implementation: "IF node with true/false branches" + + loops: + description: "Iterate over array items" + n8n_implementation: "Split In Batches node" + + data_transformation: + description: "Transform, format, or map data" + n8n_implementation: "Set node or Code node" + + error_handling: + description: "Handle errors and retries" + n8n_implementation: "Node settings: continueOnFail, retryOnFail, maxTries" + + delays: + description: "Wait before next action" + n8n_implementation: "Wait node with duration" + + webhooks: + description: "Receive HTTP requests" + n8n_implementation: "Webhook node with response configuration" + + api_calls: + description: "Make HTTP requests to APIs" + n8n_implementation: "HTTP Request node" + + parallel_execution: + description: "Execute multiple actions simultaneously" + n8n_implementation: "Multiple connections from single node" + + merge_data: + description: "Combine data from multiple sources" + n8n_implementation: "Merge node" + +# Migration considerations +migration_notes: + authentication: + - "Recreate all credentials in n8n" + - "OAuth flows may need re-authorization" + - "API keys and tokens must be securely stored" + + scheduling: + - "Convert platform-specific schedules to cron expressions" + - "Consider timezone differences" + - "Test schedule triggers before going live" + + data_formats: + - "Verify JSON structure compatibility" + - "Check date/time format conversions" + - "Validate data type mappings" + + error_handling: + - "Implement retry logic where needed" + - "Add error notification workflows" + - "Test failure scenarios" + + testing: + - "Test with sample data first" + - "Verify all integrations work correctly" + - "Monitor initial executions closely" + - "Compare outputs with original platform" diff --git a/src/modules/autominator/workflows/create-workflow/checklist.md b/src/modules/autominator/workflows/create-workflow/checklist.md new file mode 100644 index 00000000..dcd96098 --- /dev/null +++ b/src/modules/autominator/workflows/create-workflow/checklist.md @@ -0,0 +1,74 @@ +# Create n8n Workflow - Validation Checklist + +## Workflow Structure + +- [ ] Workflow has a valid name +- [ ] Workflow contains at least one trigger node +- [ ] All nodes have unique IDs +- [ ] All nodes have unique names +- [ ] Workflow JSON is valid and parseable + +## Node Configuration + +- [ ] Trigger node is properly configured +- [ ] All action nodes have required parameters set +- [ ] Node types are valid n8n node types +- [ ] Node positions are set and don't overlap +- [ ] TypeVersion is set for all nodes (usually 1) + +## Connections + +- [ ] All nodes are connected (no orphaned nodes except trigger) +- [ ] All connections reference existing node names +- [ ] Connection types are set correctly (usually "main") +- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) +- [ ] No circular dependencies (unless intentional loops) + +## Error Handling + +- [ ] Error handling strategy matches requirements +- [ ] Critical nodes have retry logic if needed +- [ ] continueOnFail is set appropriately +- [ ] maxTries and waitBetweenTries are configured if retries enabled + +## Data Flow + +- [ ] Data transformations are properly configured +- [ ] Set nodes have correct value mappings +- [ ] Code nodes have valid JavaScript/Python code +- [ ] Expressions use correct n8n syntax (={{ }}) + +## Integrations + +- [ ] All required integrations are included +- [ ] Credential placeholders are set for authenticated services +- [ ] API endpoints and methods are correct +- [ ] Request/response formats are properly configured + +## Best Practices + +- [ ] Workflow follows n8n naming conventions +- [ ] Nodes are logically organized and positioned +- [ ] Complex logic is broken into manageable steps +- [ ] Workflow is documented (node names are descriptive) + +## Testing Readiness + +- [ ] Workflow can be imported into n8n without errors +- [ ] All required credentials are identified +- [ ] Test data requirements are clear +- [ ] Expected outputs are defined + +## File Output + +- [ ] File is saved to correct location +- [ ] File has .json extension +- [ ] File is valid JSON (passes JSON.parse) +- [ ] File size is reasonable (not corrupted) + +## Documentation + +- [ ] User has been informed how to import workflow +- [ ] Credential requirements have been communicated +- [ ] Testing instructions have been provided +- [ ] Any special configuration notes have been shared diff --git a/src/modules/autominator/workflows/create-workflow/instructions.md b/src/modules/autominator/workflows/create-workflow/instructions.md new file mode 100644 index 00000000..161ddb27 --- /dev/null +++ b/src/modules/autominator/workflows/create-workflow/instructions.md @@ -0,0 +1,350 @@ +# Create n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow creates a new n8n workflow from scratch based on user requirements. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow type, trigger, integrations, complexity, requirements + + + Summarize your understanding + Skip directly to Step 2 (Check Context7 MCP) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "What type of automation workflow do you need?" + Present numbered options: + 1. Webhook-based - Receive HTTP requests and process data + 2. Scheduled - Run on a schedule (cron/interval) + 3. Event-driven - Trigger from external service events + 4. Manual - Execute on demand + 5. Database-driven - Trigger from database changes + 6. Other - Describe your specific trigger needs + + WAIT for user selection (1-6) + Store selection in {{workflow_type}} + + + Ask: "Please describe your trigger requirements" + WAIT for user input + Store in {{workflow_type}} + + + Ask Question 2: "What integrations or services will this workflow use?" + Present numbered options: + 1. HTTP/REST APIs - Generic API calls + 2. Databases - PostgreSQL, MySQL, MongoDB, etc. + 3. Cloud Services - Google Sheets, Slack, Notion, Airtable + 4. Email - Send/receive emails + 5. CRM - HubSpot, Salesforce, etc. + 6. Custom Code - JavaScript/Python logic + 7. Multiple - Combination of above + 8. Other - Specify integrations + + WAIT for user selection (1-8) + Store selection in {{integrations}} + + + Ask: "Please list all integrations needed (comma-separated)" + WAIT for user input + Store in {{integrations}} + + + Ask Question 3: "How complex is your workflow logic?" + Present numbered options: + 1. Simple (3-5 nodes) - Linear flow with minimal logic + 2. Medium (6-10 nodes) - Some conditional logic or branching + 3. Complex (11-20 nodes) - Multiple branches, loops, or error handling + 4. Very Complex (20+ nodes) - Advanced logic with parallel processing + + WAIT for user selection (1-4) + Store selection in {{complexity}} + + Ask Question 4: "Do you need error handling and retry logic?" + Present numbered options: + 1. No - Simple workflow without error handling + 2. Basic - Retry failed operations automatically + 3. Advanced - Custom error handling with notifications + 4. Comprehensive - Full error workflow with logging and alerts + + WAIT for user selection (1-4) + Store selection in {{error_handling}} + + Ask Question 5: "What should the workflow be named?" + WAIT for user input + Store in {{workflow_name}} + + Ask Question 6: "Where should the workflow file be saved?" + Present numbered options: + 1. Default location - workflows/[workflow-name].json + 2. Custom path - Specify your own file path + 3. Project root - Save in main project directory + 4. Specific folder - Choose from existing folders + + WAIT for user selection (1-4) + + Ask for specific path + WAIT for user input + + Store final path in {{save_location}} + + Ask Question 7: "Any additional requirements or specific logic needed?" + Present numbered options: + 1. No - Proceed with current requirements + 2. Yes - Describe additional requirements + + WAIT for user selection (1-2) + + Ask: "Please describe additional requirements" + WAIT for user input + Store in {{additional_requirements}} + + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 3 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation." + Ask: "Would you like help setting up Context7 MCP? (yes/no)" + WAIT for user response + + + Guide user through Context7 MCP setup: + 1. Inform user: "Context7 MCP requires the 'uvx' command (part of uv Python package manager)" + 2. Ask: "Do you have 'uv' installed? (yes/no/not sure)" + WAIT for response + + + Provide installation guidance: + - macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh + - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" + - Or via pip: pip install uv + Ask user to install and confirm when ready + WAIT for confirmation + + + 3. Inform user: "Please configure Context7 MCP in your IDE's MCP settings with:" + + Server name: context7 + Command: uvx + Args: ["context7"] + Auto-approve tools: ["resolve-library-id", "get-library-docs"] + + 4. Ask user to reconnect/restart MCP servers in their IDE + 5. Wait for user confirmation that MCP is reconnected + 6. Verify Context7 is now available + Store result in {{context7_available}} + + + + Inform: "Proceeding without Context7. Using built-in n8n knowledge." + Proceed to Step 4 + + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Workflow type: {{workflow_type}} + - Integrations: {{integrations}} + - Complexity: {{complexity}} + Store relevant documentation snippets for reference + + + + Skip Context7 query + Use built-in knowledge and templates + + + + + Based on gathered requirements, plan the workflow structure: + 1. Identify trigger node type + 2. List all action nodes needed + 3. Identify conditional logic (IF nodes) + 4. Plan data transformations (Set/Code nodes) + 5. Design error handling strategy + 6. Map node connections + + Present the planned structure to user in clear format: + - Trigger: [trigger type] + - Nodes: [list of nodes with descriptions] + - Logic: [conditional branches, loops] + - Error Handling: [strategy] + + Ask: "Does this structure meet your needs?" + Present numbered options: + 1. Yes - Proceed with this structure + 2. No - Adjust the structure + 3. Add more details - Provide additional requirements + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust structure based on feedback + Repeat this step + + + + + Load {{templates}} file + Identify closest matching template based on workflow type + Load {{helpers}} for node creation guidelines + Extract relevant template sections + + + + Follow guidelines from {{helpers}} for proper node creation + + Initialize workflow structure: + + { + "name": "{{workflow_name}}", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [] + } + + + Build nodes ONE at a time following these rules: + + For Each Node: + 1. Generate unique node ID + 2. Set node name (unique, descriptive) + 3. Set node type (e.g., n8n-nodes-base.webhook) + 4. Set typeVersion (usually 1) + 5. Calculate position: + - First node (trigger): [250, 300] + - Subsequent nodes: add 220 to x for each step + - Branches: adjust y by ±100 + 6. Configure parameters based on node type + 7. Add credentials if needed + 8. Set error handling options if required: + - continueOnFail: true/false + - retryOnFail: true/false + - maxTries: number + - waitBetweenTries: milliseconds + + + For Each Connection: + 1. Identify source node name + 2. Identify target node name + 3. Create connection entry in connections object: + "Source Node Name": [ + [ + { + "node": "Target Node Name", + "type": "main", + "index": 0 + } + ] + ] + 4. For IF nodes: + - index 0 = true branch + - index 1 = false branch + 5. Validate all referenced nodes exist + + + Node Building Order: + 1. Trigger node + 2. Main flow action nodes + 3. Conditional nodes (IF/Switch) + 4. Branch nodes + 5. Merge nodes + 6. Final action nodes + 7. Connect all nodes + + + Apply error handling based on {{error_handling}} selection + Validate all node IDs are unique + Validate all node names are unique + Validate all connections reference existing nodes + + + + Review workflow for optimization: + - Remove any unused nodes + - Verify node positions don't overlap + - Ensure proper spacing and alignment + - Validate all required parameters are set + + Save workflow to {{save_location}} + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "n8n workflow created at {{save_location}}" + + + + Inform user how to use the workflow: + 1. Import the JSON file into n8n + 2. Configure credentials for integrated services + 3. Test the workflow with sample data + 4. Activate the workflow when ready + + Ask: "Would you like me to explain any part of the workflow?" + Present numbered options: + 1. No - I'm good to go + 2. Yes - Explain specific nodes + 3. Yes - Explain the overall flow + 4. Yes - Explain how to test it + + WAIT for user selection (1-4) + + + Provide requested explanation + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/autominator/workflows/create-workflow/workflow.yaml b/src/modules/autominator/workflows/create-workflow/workflow.yaml new file mode 100644 index 00000000..6f91fb8f --- /dev/null +++ b/src/modules/autominator/workflows/create-workflow/workflow.yaml @@ -0,0 +1,31 @@ +name: create-workflow +description: "Create new n8n workflow from scratch based on requirements" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow" +shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_type: "" # Will be elicited + trigger_type: "" # Will be elicited + integrations: [] # Will be elicited + complexity: "" # Will be elicited + error_handling: "" # Will be elicited + save_location: "" # Will be elicited + workflow_name: "" # Will be elicited + additional_requirements: "" # Will be elicited + context7_available: false # Will be checked + +default_output_file: "{project-root}/workflows/workflow-{timestamp}.json" + +standalone: true +web_bundle: false diff --git a/src/modules/autominator/workflows/migrate-workflow/checklist.md b/src/modules/autominator/workflows/migrate-workflow/checklist.md new file mode 100644 index 00000000..22e6e675 --- /dev/null +++ b/src/modules/autominator/workflows/migrate-workflow/checklist.md @@ -0,0 +1,110 @@ +# Migrate Workflow to n8n - Validation Checklist + +## Source Analysis + +- [ ] Source platform was identified +- [ ] Source workflow details were gathered +- [ ] Trigger type was identified +- [ ] All integrations were identified +- [ ] Workflow complexity was assessed + +## Platform Mapping + +- [ ] Platform mappings were loaded +- [ ] Source trigger was mapped to n8n trigger +- [ ] All source actions were mapped to n8n nodes +- [ ] Conditional logic was mapped correctly +- [ ] Loops/iterations were mapped correctly +- [ ] Data transformations were identified + +## Workflow Structure + +- [ ] n8n workflow has valid JSON structure +- [ ] Workflow name is set +- [ ] Migration tag is added (migrated-from-[platform]) +- [ ] All nodes have unique IDs +- [ ] All nodes have unique names +- [ ] Trigger node is properly configured + +## Node Configuration + +- [ ] All mapped nodes are created +- [ ] Node types are valid n8n types +- [ ] Node parameters are configured +- [ ] Credentials placeholders are set +- [ ] Node positions are calculated correctly +- [ ] No overlapping nodes + +## Data Mappings + +- [ ] Field mappings from source to n8n are correct +- [ ] Data type conversions are handled +- [ ] Date/time format differences are addressed +- [ ] Expressions use correct n8n syntax (={{ }}) +- [ ] Set nodes are used for simple transformations +- [ ] Code nodes are used for complex transformations + +## Conditional Logic + +- [ ] IF nodes are created for conditional branches +- [ ] Switch nodes are created for multiple conditions +- [ ] Conditions are properly configured +- [ ] True/false branches are correct (index 0/1) +- [ ] All branches are connected + +## Connections + +- [ ] All nodes are connected properly +- [ ] Trigger connects to first action +- [ ] Actions are connected in sequence +- [ ] Conditional branches are connected +- [ ] Merge points are connected +- [ ] All connections reference existing nodes +- [ ] No orphaned nodes (except trigger) + +## Error Handling + +- [ ] Error handling strategy is defined +- [ ] Critical nodes have retry logic if needed +- [ ] continueOnFail is set appropriately +- [ ] Error handling matches or improves on source + +## Migration Notes + +- [ ] Source platform is documented +- [ ] Migration date is recorded +- [ ] Credentials needed are listed +- [ ] Platform-specific differences are noted +- [ ] Testing considerations are documented + +## Validation + +- [ ] Workflow passes JSON validation +- [ ] All required parameters are set +- [ ] Workflow structure is logical +- [ ] Migration matches source workflow functionality + +## Credentials & Authentication + +- [ ] All services requiring credentials are identified +- [ ] Credential types are correct for n8n +- [ ] OAuth requirements are noted +- [ ] API key requirements are noted +- [ ] Authentication differences from source are documented + +## Testing Readiness + +- [ ] Workflow can be imported into n8n +- [ ] Test data requirements are clear +- [ ] Expected outputs are defined +- [ ] Comparison approach with source is defined +- [ ] Initial monitoring plan is suggested + +## Documentation + +- [ ] User has import instructions +- [ ] Credential setup guidance provided +- [ ] Data mapping explanations provided +- [ ] Testing approach explained +- [ ] Platform differences highlighted +- [ ] Post-migration checklist provided diff --git a/src/modules/autominator/workflows/migrate-workflow/instructions.md b/src/modules/autominator/workflows/migrate-workflow/instructions.md new file mode 100644 index 00000000..17ffd53d --- /dev/null +++ b/src/modules/autominator/workflows/migrate-workflow/instructions.md @@ -0,0 +1,350 @@ +# Migrate Workflow to n8n - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow migrates automation workflows from other platforms to n8n. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: source platform, workflow details, integrations, file paths + + + Summarize your understanding + Skip directly to Step 2 (Check Context7 MCP) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which platform are you migrating from?" + Present numbered options: + 1. Zapier - Migrate Zapier Zaps to n8n + 2. Make (Integromat) - Migrate Make scenarios to n8n + 3. HubSpot Workflows - Migrate HubSpot workflows to n8n + 4. Microsoft Power Automate - Migrate Power Automate flows to n8n + 5. IFTTT - Migrate IFTTT applets to n8n + 6. Other - Specify another automation platform + + WAIT for user selection (1-6) + Store selection in {{source_platform}} + + + Ask: "Please specify the platform you're migrating from" + WAIT for user input + Store in {{source_platform}} + + + Ask Question 2: "How will you provide the workflow to migrate?" + Present numbered options: + 1. Describe it - Explain what the workflow does + 2. Provide export file - Upload/paste workflow export file + 3. Provide screenshots - Share workflow screenshots + 4. Provide documentation - Share workflow documentation + + WAIT for user selection (1-4) + + + Ask: "Please describe what the workflow does (trigger, actions, logic)" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow export file path or paste the content" + WAIT for user input + Store in {{workflow_file}} or {{workflow_content}} + + + + Ask: "Please share the workflow screenshots and describe the flow" + WAIT for user input + Store in {{workflow_description}} + + + + Ask: "Please provide the workflow documentation" + WAIT for user input + Store in {{workflow_description}} + + + Ask Question 3: "What is the trigger for this workflow?" + Present numbered options: + 1. Webhook/HTTP Request - Triggered by incoming HTTP requests + 2. Schedule/Cron - Runs on a schedule + 3. Form Submission - Triggered by form submissions + 4. Database Change - Triggered by database events + 5. Email - Triggered by incoming emails + 6. Service Event - Triggered by external service (Slack, Google Sheets, etc.) + 7. Not sure - Will determine from workflow details + + WAIT for user selection (1-7) + Store selection in {{trigger_type}} + + Ask Question 4: "What integrations/services does this workflow use?" + Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)" + WAIT for user input + Store in {{integrations_used}} + + Ask Question 5: "How complex is the workflow?" + Present numbered options: + 1. Simple - Linear flow with 3-5 steps + 2. Medium - Some conditional logic, 6-10 steps + 3. Complex - Multiple branches, loops, 11-20 steps + 4. Very Complex - Advanced logic, 20+ steps + + WAIT for user selection (1-4) + Store selection in {{complexity}} + + Ask Question 6: "What should the migrated workflow be named?" + WAIT for user input + Store in {{workflow_name}} + + Ask Question 7: "Where should the n8n workflow file be saved?" + Present numbered options: + 1. Default location - workflows/[workflow-name].json + 2. Custom path - Specify your own file path + 3. Project root - Save in main project directory + + WAIT for user selection (1-3) + + Ask for specific path + WAIT for user input + + Store final path in {{save_location}} + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 3 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge." + Proceed to Step 4 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Integrations used: {{integrations_used}} + - Trigger type: {{trigger_type}} + - Source platform: {{source_platform}} + Store relevant documentation snippets for reference + + + + + Load {{platform_mappings}} file + Extract mappings for {{source_platform}} + Identify equivalent n8n nodes for source platform components + + + + + Parse source workflow file/content + Extract workflow structure + + + Analyze workflow based on description and details: + 1. Identify trigger type and configuration + 2. List all actions/steps in order + 3. Identify conditional logic (if/then branches) + 4. Identify loops or iterations + 5. Identify data transformations + 6. Identify error handling + 7. Map integrations to n8n nodes + + Present analysis to user: + - Source trigger: [platform-specific trigger] + - n8n trigger: [mapped n8n node] + - Source actions: [list with platform names] + - n8n actions: [list with n8n node types] + - Logic: [conditional branches, loops] + - Transformations: [data mapping needs] + + + + Load {{helpers}} for node creation guidelines + Load {{templates}} for reference + + Design n8n workflow structure: + 1. Map source trigger to n8n trigger node + 2. Map each source action to n8n node(s) + 3. Convert conditional logic to IF/Switch nodes + 4. Convert loops to Split In Batches nodes + 5. Add Set/Code nodes for data transformations + 6. Plan node connections + 7. Add error handling where needed + + Present migration plan to user: + - n8n Trigger: [node type and configuration] + - n8n Nodes: [list with descriptions] + - Connections: [flow diagram] + - Data Mappings: [field mappings] + - Credentials Needed: [list of integrations requiring auth] + + Ask: "Does this migration plan look correct?" + Present numbered options: + 1. Yes - Proceed with migration + 2. No - Adjust the plan + 3. Add more details - Provide additional information + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust plan based on feedback + Repeat this step + + + + + Follow guidelines from {{helpers}} for proper node creation + + Initialize workflow structure: + + { + "name": "{{workflow_name}}", + "nodes": [], + "connections": {}, + "active": false, + "settings": { + "executionOrder": "v1" + }, + "tags": [ + { + "name": "migrated-from-{{source_platform}}" + } + ] + } + + + Build nodes ONE at a time: + + For Each Mapped Node: + 1. Generate unique node ID + 2. Set node name (descriptive, unique) + 3. Set node type from platform mappings + 4. Set typeVersion (usually 1) + 5. Calculate position (220px spacing) + 6. Configure parameters based on source workflow + 7. Map data fields from source to n8n format + 8. Add credentials placeholder if needed + 9. Set error handling if required + + + For Data Transformations: + 1. Identify field mappings needed + 2. Create Set nodes for simple mappings + 3. Create Code nodes for complex transformations + 4. Use n8n expressions: ={{ $json.fieldName }} + 5. Handle data type conversions + 6. Handle date/time format differences + + + For Conditional Logic: + 1. Create IF nodes for if/then branches + 2. Create Switch nodes for multiple conditions + 3. Map source conditions to n8n condition format + 4. Set up true/false branches (index 0/1) + + + For Connections: + 1. Connect trigger to first action + 2. Connect actions in sequence + 3. Connect conditional branches + 4. Connect merge points + 5. Validate all connections + + + Add migration notes as workflow tags + Validate all node IDs are unique + Validate all connections reference existing nodes + + + + Add comment nodes or documentation: + - Source platform: {{source_platform}} + - Migration date: {timestamp} + - Credentials to configure: [list] + - Testing notes: [important considerations] + - Platform-specific differences: [notes] + + + + Save workflow to {{save_location}} + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow migrated successfully to {{save_location}}" + + + + Provide post-migration instructions: + 1. Import the JSON file into n8n + 2. Configure credentials for these services: [list] + 3. Review and update these data mappings: [list] + 4. Test with sample data before activating + 5. Compare outputs with original platform + 6. Monitor initial executions closely + + Highlight platform-specific differences: + - Authentication: [differences] + - Data formats: [differences] + - Scheduling: [differences] + - Error handling: [differences] + + Ask: "Would you like help with any specific part of the migration?" + Present numbered options: + 1. No - I'm ready to test + 2. Yes - Explain credential setup + 3. Yes - Explain data mappings + 4. Yes - Explain testing approach + + WAIT for user selection (1-4) + + + Provide requested explanation + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/autominator/workflows/migrate-workflow/workflow.yaml b/src/modules/autominator/workflows/migrate-workflow/workflow.yaml new file mode 100644 index 00000000..d0fa5839 --- /dev/null +++ b/src/modules/autominator/workflows/migrate-workflow/workflow.yaml @@ -0,0 +1,32 @@ +name: migrate-workflow +description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/autominator/workflows/migrate-workflow" +shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + source_platform: "" # Will be elicited + workflow_description: "" # Will be elicited + workflow_file: "" # Will be elicited (optional) + workflow_content: "" # Will be elicited (optional) + integrations_used: [] # Will be elicited + trigger_type: "" # Will be elicited + complexity: "" # Will be elicited + save_location: "" # Will be elicited + workflow_name: "" # Will be elicited + context7_available: false # Will be checked + +default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json" + +standalone: true +web_bundle: false diff --git a/src/modules/autominator/workflows/modify-workflow/checklist.md b/src/modules/autominator/workflows/modify-workflow/checklist.md new file mode 100644 index 00000000..9534b32b --- /dev/null +++ b/src/modules/autominator/workflows/modify-workflow/checklist.md @@ -0,0 +1,90 @@ +# Modify n8n Workflow - Validation Checklist + +## Pre-Modification + +- [ ] Original workflow file was successfully loaded +- [ ] Workflow JSON was valid before modifications +- [ ] Backup was created before making changes +- [ ] User requirements were clearly understood + +## Workflow Structure + +- [ ] Workflow maintains valid JSON structure +- [ ] Workflow name is preserved (unless intentionally changed) +- [ ] All nodes still have unique IDs +- [ ] All nodes still have unique names +- [ ] Workflow settings are preserved + +## Node Modifications + +- [ ] Added nodes have unique IDs +- [ ] Added nodes have unique names +- [ ] Added nodes have valid node types +- [ ] Added nodes have required parameters set +- [ ] Modified nodes preserve their IDs +- [ ] Modified nodes have valid parameter values +- [ ] Removed nodes are completely removed from nodes array + +## Connections + +- [ ] All connections reference existing nodes +- [ ] Connections to/from added nodes are properly configured +- [ ] Connections affected by removed nodes are updated +- [ ] No orphaned connections remain +- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) +- [ ] No circular dependencies (unless intentional) + +## Node Positioning + +- [ ] New nodes have valid positions +- [ ] New nodes don't overlap with existing nodes +- [ ] Node positions follow spacing guidelines (220px horizontal) +- [ ] Branch nodes have appropriate vertical spacing (±100px) + +## Error Handling + +- [ ] Error handling modifications are applied correctly +- [ ] Retry logic is properly configured if added +- [ ] continueOnFail settings are appropriate +- [ ] maxTries and waitBetweenTries are set if retries enabled + +## Data Flow + +- [ ] Data flow is maintained after modifications +- [ ] New transformations are properly configured +- [ ] Expressions use correct n8n syntax (={{ }}) +- [ ] No data flow breaks introduced + +## Integration Changes + +- [ ] New integrations are properly configured +- [ ] Credential requirements are identified +- [ ] API configurations are correct +- [ ] Existing integrations still work + +## Validation + +- [ ] Modified workflow passes JSON validation +- [ ] All modifications match user requirements +- [ ] No unintended changes were made +- [ ] Workflow structure is still logical + +## Backup & Recovery + +- [ ] Backup file was created successfully +- [ ] Backup location was communicated to user +- [ ] Original workflow can be restored if needed + +## Testing Readiness + +- [ ] Modified workflow can be imported into n8n +- [ ] Changes are testable +- [ ] Expected behavior is clear +- [ ] Any new credentials needed are identified + +## Documentation + +- [ ] Changes made are summarized for user +- [ ] User understands what was modified +- [ ] Testing recommendations provided if needed +- [ ] Backup location shared with user diff --git a/src/modules/autominator/workflows/modify-workflow/instructions.md b/src/modules/autominator/workflows/modify-workflow/instructions.md new file mode 100644 index 00000000..5f086d95 --- /dev/null +++ b/src/modules/autominator/workflows/modify-workflow/instructions.md @@ -0,0 +1,327 @@ +# Modify n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow modifies an existing n8n workflow based on user requirements. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow file path, changes needed, specific nodes + + + Summarize your understanding + Skip directly to Step 2 (Load Existing Workflow) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which workflow file do you want to modify?" + Present numbered options: + 1. Provide file path - Specify exact path to workflow JSON + 2. Search in workflows folder - List available workflows + 3. Paste workflow JSON - Provide workflow content directly + + WAIT for user selection (1-3) + + + Ask: "Please provide the file path to the workflow JSON" + WAIT for user input + Store in {{workflow_file}} + + + + List all .json files in workflows/ directory + Present as numbered list + WAIT for user selection + Store selected file path in {{workflow_file}} + + + + Ask: "Please paste the workflow JSON content" + WAIT for user input + Create temporary file with content + Store temp file path in {{workflow_file}} + + + Ask Question 2: "What type of modification do you need?" + Present numbered options: + 1. Add new nodes - Add functionality to existing workflow + 2. Modify existing nodes - Change node parameters or configuration + 3. Remove nodes - Delete nodes from workflow + 4. Change connections - Modify how nodes are connected + 5. Update error handling - Add or modify retry/error logic + 6. Optimize workflow - Improve performance or structure + 7. Multiple changes - Combination of above + + WAIT for user selection (1-7) + Store selection in {{modification_type}} + + Ask Question 3: "Please describe the changes you want to make" + WAIT for user input + Store in {{changes_description}} + + + Ask: "What nodes do you want to add? (describe functionality)" + WAIT for user input + Store in {{nodes_to_add}} + + + + Ask: "Which nodes do you want to modify? (provide node names or descriptions)" + WAIT for user input + Store in {{nodes_to_modify}} + + + + Ask: "Which nodes do you want to remove? (provide node names)" + WAIT for user input + Store in {{nodes_to_remove}} + + + + + Only load the workflow file when user provides it - never preload + + Read workflow file from {{workflow_file}} + Parse JSON content + Validate JSON structure + + + Inform user: "The workflow file has invalid JSON syntax" + Show error details + Ask: "Would you like me to fix the JSON syntax first? (yes/no)" + WAIT for user response + + + Fix JSON syntax errors + Save corrected file + Proceed with loading + + + + Exit workflow with error + + + + Extract workflow structure: + - Workflow name + - List of nodes (names, types, IDs) + - Connections map + - Current settings + + Display workflow summary to user: + - Name: [workflow name] + - Nodes: [count] nodes + - Node list: [node names and types] + - Connections: [connection count] + + + + Create backup of original workflow + Save backup to: {{workflow_file}}.backup-{timestamp} + Store true in {{backup_created}} + Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 5 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Proceeding with built-in knowledge." + Proceed to Step 6 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for relevant n8n documentation based on: + - Modification type: {{modification_type}} + - Nodes to add: {{nodes_to_add}} + - Changes description: {{changes_description}} + Store relevant documentation snippets for reference + + + + + Load {{helpers}} for node creation guidelines + Analyze current workflow structure + Plan modifications based on requirements: + + + 1. Identify where new nodes should be inserted + 2. Determine node types needed + 3. Plan connections to/from new nodes + 4. Calculate positions for new nodes + + + + 1. Identify nodes to modify by name or ID + 2. Determine what parameters to change + 3. Validate new parameter values + + + + 1. Identify nodes to remove by name or ID + 2. Identify connections that will be affected + 3. Plan how to reconnect remaining nodes + + + + 1. Identify connections to modify + 2. Validate new connection targets exist + 3. Update connection indices if needed + + + Present modification plan to user: + - Changes to be made: [detailed list] + - Nodes affected: [list] + - New connections: [list] + - Removed connections: [list] + + Ask: "Does this modification plan look correct?" + Present numbered options: + 1. Yes - Proceed with modifications + 2. No - Adjust the plan + 3. Add more changes - Include additional modifications + + WAIT for user selection (1-3) + + + Ask: "What changes or additions are needed?" + WAIT for user input + Adjust plan based on feedback + Repeat this step + + + + + Follow guidelines from {{helpers}} for proper node creation + + Load current workflow JSON into memory + + If Adding Nodes: + 1. Generate unique node IDs (check against existing IDs) + 2. Create node objects with proper structure + 3. Calculate positions (avoid overlaps with existing nodes) + 4. Add nodes to workflow.nodes array + 5. Create connections to/from new nodes + 6. Update connections object + + + If Modifying Nodes: + 1. Find nodes by name or ID + 2. Update parameters as specified + 3. Preserve node ID and other unchanged properties + 4. Validate new parameter values + 5. Update node in workflow.nodes array + + + If Removing Nodes: + 1. Find nodes by name or ID + 2. Remove from workflow.nodes array + 3. Remove all connections to/from removed nodes + 4. Update connections object + 5. Reconnect remaining nodes if needed + + + If Changing Connections: + 1. Update connections object + 2. Validate all referenced nodes exist + 3. Ensure connection indices are correct + 4. Remove orphaned connections + + + If Updating Error Handling: + 1. Find affected nodes + 2. Add or update error handling properties: + - continueOnFail + - retryOnFail + - maxTries + - waitBetweenTries + 3. Validate error handling configuration + + + Validate modified workflow: + - All node IDs are unique + - All node names are unique + - All connections reference existing nodes + - No orphaned nodes (except trigger) + - Node positions don't overlap + + + + Save modified workflow to {{workflow_file}} + Preserve original file location + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow modified successfully at {{workflow_file}}" + + + + Provide summary of changes made: + - Nodes added: [count and names] + - Nodes modified: [count and names] + - Nodes removed: [count and names] + - Connections changed: [count] + - Backup location: {{workflow_file}}.backup-{timestamp} + + Ask: "Would you like to make additional changes?" + Present numbered options: + 1. No - I'm done + 2. Yes - Make more modifications + 3. Revert - Restore from backup + + WAIT for user selection (1-3) + + + Return to Step 1 with current workflow + + + + Restore workflow from backup + Confirm restoration to user + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/autominator/workflows/modify-workflow/workflow.yaml b/src/modules/autominator/workflows/modify-workflow/workflow.yaml new file mode 100644 index 00000000..1822a0bf --- /dev/null +++ b/src/modules/autominator/workflows/modify-workflow/workflow.yaml @@ -0,0 +1,30 @@ +name: modify-workflow +description: "Edit or update existing n8n workflow" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/autominator/workflows/modify-workflow" +shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_file: "" # Will be elicited + modification_type: "" # Will be elicited + changes_description: "" # Will be elicited + nodes_to_add: [] # Will be elicited + nodes_to_modify: [] # Will be elicited + nodes_to_remove: [] # Will be elicited + backup_created: false # Will be set + context7_available: false # Will be checked + +default_output_file: "" # Will use existing file location + +standalone: true +web_bundle: false diff --git a/src/modules/autominator/workflows/optimize-workflow/checklist.md b/src/modules/autominator/workflows/optimize-workflow/checklist.md new file mode 100644 index 00000000..a5bbd1f2 --- /dev/null +++ b/src/modules/autominator/workflows/optimize-workflow/checklist.md @@ -0,0 +1,130 @@ +# Optimize n8n Workflow - Validation Checklist + +## Pre-Optimization + +- [ ] Original workflow was successfully loaded +- [ ] Workflow JSON was valid before optimization +- [ ] Optimization focus areas were identified +- [ ] Backup was created before making changes +- [ ] User requirements were clearly understood + +## Analysis Completeness + +- [ ] Performance analysis was conducted +- [ ] Error handling was reviewed +- [ ] Code quality was assessed +- [ ] Structure was evaluated +- [ ] Best practices were checked +- [ ] Security was reviewed +- [ ] All issues were documented + +## Recommendations Quality + +- [ ] Recommendations are specific and actionable +- [ ] Recommendations are prioritized correctly +- [ ] Impact of each recommendation is clear +- [ ] Implementation steps are provided +- [ ] Expected improvements are quantified +- [ ] No breaking changes are recommended + +## Performance Optimizations + +- [ ] Unnecessary nodes were identified/removed +- [ ] Data transformations were optimized +- [ ] Batch processing opportunities were identified +- [ ] Redundant API calls were consolidated +- [ ] Parallel execution opportunities were identified +- [ ] Node execution order was optimized + +## Error Handling Improvements + +- [ ] Critical nodes have retry logic +- [ ] continueOnFail is set appropriately +- [ ] Error workflows are configured where needed +- [ ] Timeout configurations are appropriate +- [ ] Error notifications are set up +- [ ] Error handling doesn't mask real issues + +## Code Quality Improvements + +- [ ] Set nodes are properly configured +- [ ] Code nodes are optimized +- [ ] Expressions use correct syntax +- [ ] Data types are handled correctly +- [ ] Hardcoded values are replaced with variables +- [ ] Node names are descriptive and consistent + +## Structure Improvements + +- [ ] Node positions are logical and organized +- [ ] Complex branches are simplified where possible +- [ ] Duplicate logic is eliminated +- [ ] Merge points are optimized +- [ ] Connection patterns are clean +- [ ] Workflow flow is easy to follow + +## Best Practices Applied + +- [ ] Credentials are used correctly +- [ ] Security issues are addressed +- [ ] Node types are appropriate +- [ ] Node versions are up to date +- [ ] Data handling follows best practices +- [ ] Workflow settings are optimal + +## Security Improvements + +- [ ] No credentials are exposed +- [ ] Sensitive data is handled properly +- [ ] No hardcoded secrets remain +- [ ] Authentication is properly configured +- [ ] Data is sanitized where needed +- [ ] Security best practices are followed + +## Workflow Integrity + +- [ ] All node IDs remain unique +- [ ] All node names remain unique +- [ ] All connections are valid +- [ ] No functionality is lost +- [ ] Workflow still achieves original purpose +- [ ] No breaking changes introduced + +## Validation + +- [ ] Optimized workflow passes JSON validation +- [ ] All optimizations were applied correctly +- [ ] No unintended changes were made +- [ ] Workflow structure is still logical +- [ ] All improvements are documented + +## Backup & Recovery + +- [ ] Backup file was created successfully +- [ ] Backup location was communicated to user +- [ ] Original workflow can be restored if needed + +## Testing Readiness + +- [ ] Optimized workflow can be imported into n8n +- [ ] Test scenarios are identified +- [ ] Expected improvements are measurable +- [ ] Comparison approach is defined +- [ ] Monitoring plan is suggested + +## Documentation + +- [ ] Analysis report is comprehensive +- [ ] All findings are documented +- [ ] Recommendations are clearly explained +- [ ] Expected improvements are quantified +- [ ] Testing recommendations are provided +- [ ] User understands all changes made + +## Expected Improvements + +- [ ] Performance improvements are quantified +- [ ] Reliability improvements are identified +- [ ] Maintainability improvements are clear +- [ ] Security improvements are documented +- [ ] Cost savings are estimated (if applicable) diff --git a/src/modules/autominator/workflows/optimize-workflow/instructions.md b/src/modules/autominator/workflows/optimize-workflow/instructions.md new file mode 100644 index 00000000..b8823d11 --- /dev/null +++ b/src/modules/autominator/workflows/optimize-workflow/instructions.md @@ -0,0 +1,446 @@ +# Optimize n8n Workflow - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow analyzes and optimizes existing n8n workflows for performance and best practices. + + + + + Before asking any questions, analyze what the user has already told you + + Review the user's initial request and conversation history + Extract any mentioned: workflow file path, performance issues, optimization goals + + + Summarize your understanding + Skip directly to Step 2 (Load Workflow) + + + + Note what you already know + Only ask about missing information in Step 1 + + + + Proceed with full elicitation in Step 1 + + + + + Ask Question 1: "Which workflow do you want to optimize?" + Present numbered options: + 1. Provide file path - Specify exact path to workflow JSON + 2. Search in workflows folder - List available workflows + 3. Paste workflow JSON - Provide workflow content directly + + WAIT for user selection (1-3) + + + Ask: "Please provide the file path to the workflow JSON" + WAIT for user input + Store in {{workflow_file}} + + + + List all .json files in workflows/ directory + Present as numbered list + WAIT for user selection + Store selected file path in {{workflow_file}} + + + + Ask: "Please paste the workflow JSON content" + WAIT for user input + Create temporary file with content + Store temp file path in {{workflow_file}} + + + Ask Question 2: "What aspects do you want to optimize?" + Present numbered options (can select multiple): + 1. Performance - Improve execution speed and efficiency + 2. Error Handling - Add or improve error handling and retries + 3. Code Quality - Improve node configuration and data transformations + 4. Structure - Improve workflow organization and readability + 5. Best Practices - Apply n8n best practices and patterns + 6. Security - Improve credential handling and data security + 7. All - Comprehensive optimization review + + WAIT for user selection (1-7 or multiple) + Store selections in {{optimization_focus}} + + Ask Question 3: "Are there specific issues or pain points?" + Present numbered options: + 1. No - Just general optimization + 2. Yes - Describe specific issues + + WAIT for user selection (1-2) + + + Ask: "Please describe the issues (slow execution, errors, etc.)" + WAIT for user input + Store in {{specific_issues}} + + + + + Only load the workflow file when user provides it - never preload + + Read workflow file from {{workflow_file}} + Parse JSON content + Validate JSON structure + + + Inform user: "The workflow file has invalid JSON syntax" + Show error details + Ask: "Would you like me to fix the JSON syntax first? (yes/no)" + WAIT for user response + + + Fix JSON syntax errors + Save corrected file + Proceed with loading + + + + Exit workflow with error + + + + Extract workflow structure: + - Workflow name and settings + - Node count and types + - Connection patterns + - Error handling configuration + - Credential usage + + Display workflow summary to user: + - Name: [workflow name] + - Nodes: [count] nodes + - Complexity: [simple/medium/complex] + - Integrations: [list of services] + + + + Check if Context7 MCP server is configured + Try to list available MCP tools + + + Store true in {{context7_available}} + Proceed to Step 4 + + + + Store false in {{context7_available}} + Inform user: "Context7 MCP not configured. Using built-in n8n best practices." + Proceed to Step 5 + + + + + + Resolve n8n library ID using Context7 + Query Context7 for n8n best practices documentation + Query for optimization techniques + Query for performance tips + Store relevant documentation for reference + + + + + Load {{helpers}} for best practices reference + + Perform comprehensive analysis based on {{optimization_focus}}: + + Performance Analysis: + - Check for unnecessary nodes + - Identify inefficient data transformations + - Look for missing batch processing opportunities + - Check for redundant API calls + - Analyze node execution order + - Identify parallel execution opportunities + + + Error Handling Analysis: + - Check if critical nodes have retry logic + - Verify continueOnFail settings + - Look for missing error workflows + - Check timeout configurations + - Verify error notification setup + + + Code Quality Analysis: + - Review Set node configurations + - Review Code node implementations + - Check expression syntax and efficiency + - Verify data type handling + - Check for hardcoded values + - Review node naming conventions + + + Structure Analysis: + - Check node positioning and layout + - Verify logical flow organization + - Look for overly complex branches + - Check for duplicate logic + - Verify proper use of merge nodes + - Check connection patterns + + + Best Practices Analysis: + - Verify proper credential usage + - Check for security issues + - Verify proper use of node types + - Check for deprecated node versions + - Verify proper data handling + - Check workflow settings + + + Security Analysis: + - Check credential exposure + - Verify sensitive data handling + - Check for hardcoded secrets + - Verify proper authentication + - Check data sanitization + + + Store all findings in {{issues_found}} + + + + For each issue found, generate specific recommendations: + + Categorize recommendations by priority: + - Critical: Security issues, major performance problems + - High: Error handling gaps, significant inefficiencies + - Medium: Code quality improvements, minor optimizations + - Low: Cosmetic improvements, nice-to-haves + + For each recommendation, provide: + 1. Issue description + 2. Impact explanation + 3. Specific solution + 4. Implementation steps + 5. Expected improvement + + Store recommendations in {{recommendations}} + + + + Present comprehensive optimization report: + + ## Workflow Analysis Report + Workflow: {{workflow_name}} + Analysis Date: {timestamp} + Optimization Focus: {{optimization_focus}} + + ### Summary + - Total Issues Found: [count] + - Critical: [count] + - High Priority: [count] + - Medium Priority: [count] + - Low Priority: [count] + + ### Detailed Findings + Present each issue with: + - Priority level + - Issue description + - Current state + - Recommended solution + - Expected impact + + ### Performance Opportunities + List specific performance improvements with estimated impact + + ### Best Practice Violations + List n8n best practices not being followed + + Ask: "Would you like me to apply these optimizations?" + Present numbered options: + 1. Yes - Apply all recommendations + 2. Yes - Apply only critical and high priority + 3. Yes - Let me choose which to apply + 4. No - Just provide the report + 5. Explain more - I need more details first + + WAIT for user selection (1-5) + + + Ask: "Which recommendations would you like explained?" + WAIT for user input + Provide detailed explanation + Repeat this step + + + + Present recommendations as numbered list + Ask: "Select recommendations to apply (comma-separated numbers)" + WAIT for user input + Store selected recommendations + + + + Store true in {{apply_changes}} + Proceed to Step 8 + + + + Store false in {{apply_changes}} + Skip to Step 11 (provide report only) + + + + + + Create backup of original workflow + Save backup to: {{workflow_file}}.backup-{timestamp} + Store true in {{backup_created}} + Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" + + + + + Follow guidelines from {{helpers}} for proper node configuration + + Load current workflow JSON into memory + + Apply each selected recommendation: + + Performance Optimizations: + - Remove unnecessary nodes + - Optimize data transformations + - Add batch processing where applicable + - Consolidate redundant API calls + - Optimize node execution order + - Add parallel execution where possible + + + Error Handling Improvements: + - Add retry logic to critical nodes + - Set appropriate continueOnFail values + - Add error workflows if needed + - Configure timeouts + - Add error notifications + + + Code Quality Improvements: + - Refactor Set node configurations + - Optimize Code node implementations + - Improve expression syntax + - Fix data type handling + - Replace hardcoded values with variables + - Improve node naming + + + Structure Improvements: + - Reorganize node positions + - Simplify complex branches + - Remove duplicate logic + - Optimize merge points + - Improve connection patterns + + + Best Practice Applications: + - Fix credential usage + - Address security issues + - Update deprecated nodes + - Improve data handling + - Update workflow settings + + + Validate optimized workflow: + - All node IDs remain unique + - All connections are valid + - No functionality is lost + - All improvements are applied + + + + Save optimized workflow to {{workflow_file}} + + + + + NEVER delete the file if validation fails - always fix syntax errors + + Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" + + + Read the error message carefully - it shows the syntax error and position + Open the file and navigate to the error location + Fix the syntax error (add missing comma, bracket, or quote as indicated) + Save the file + Re-run validation with the same command + Repeat until validation passes + + + Once validation passes, confirm with user: "Workflow optimized successfully at {{workflow_file}}" + + + + + Provide comprehensive summary: + + + ### Optimizations Applied + - Total changes: [count] + - Performance improvements: [list] + - Error handling added: [list] + - Code quality fixes: [list] + - Structure improvements: [list] + - Best practices applied: [list] + - Backup location: {{workflow_file}}.backup-{timestamp} + + ### Expected Improvements + - Execution speed: [estimated improvement] + - Reliability: [improvements] + - Maintainability: [improvements] + - Security: [improvements] + + ### Testing Recommendations + 1. Import optimized workflow into n8n + 2. Test with sample data + 3. Compare execution times with original + 4. Verify all functionality works correctly + 5. Monitor error rates + + + + ### Optimization Report + Report saved with all recommendations + No changes applied to workflow + Review recommendations and apply manually if desired + + + Ask: "Would you like additional help?" + Present numbered options: + 1. No - I'm done + 2. Yes - Explain specific optimizations + 3. Yes - Optimize another workflow + 4. Revert - Restore from backup + + WAIT for user selection (1-4) + + + Ask: "Which optimization would you like explained?" + WAIT for user input + Provide detailed explanation + + + + Return to Step 1 for new workflow + + + + Restore workflow from backup + Confirm restoration to user + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/autominator/workflows/optimize-workflow/workflow.yaml b/src/modules/autominator/workflows/optimize-workflow/workflow.yaml new file mode 100644 index 00000000..2e013480 --- /dev/null +++ b/src/modules/autominator/workflows/optimize-workflow/workflow.yaml @@ -0,0 +1,29 @@ +name: optimize-workflow +description: "Review and improve existing n8n workflows for performance and best practices" +author: "Saif" + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/autominator/workflows/optimize-workflow" +shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Shared resources +helpers: "{shared_path}/n8n-helpers.md" +templates: "{shared_path}/n8n-templates.yaml" +platform_mappings: "{shared_path}/platform-mappings.yaml" + +# Variables +variables: + workflow_file: "" # Will be elicited + optimization_focus: [] # Will be elicited + issues_found: [] # Will be identified + recommendations: [] # Will be generated + apply_changes: false # Will be elicited + backup_created: false # Will be set + context7_available: false # Will be checked + +default_output_file: "" # Will use existing file location + +standalone: true +web_bundle: false From ebc5acd2aabaa97c579b04c71742992ec1c1295d Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Thu, 20 Nov 2025 14:28:53 +0500 Subject: [PATCH 09/16] chore(autominator): finalize standalone module and clean up - Remove old autominator files from BMM module - Verify module independence (no BMM dependencies) - All 21 agents validated successfully - All tests pass with new structure - Module ready for standalone distribution --- src/modules/bmm/agents/autominator.agent.yaml | 44 -- .../autominator/_shared/n8n-helpers.md | 201 -------- .../autominator/_shared/n8n-templates.yaml | 299 ------------ .../_shared/platform-mappings.yaml | 282 ----------- .../autominator/create-workflow/checklist.md | 74 --- .../create-workflow/instructions.md | 350 -------------- .../autominator/create-workflow/workflow.yaml | 31 -- .../autominator/migrate-workflow/checklist.md | 110 ----- .../migrate-workflow/instructions.md | 350 -------------- .../migrate-workflow/workflow.yaml | 32 -- .../autominator/modify-workflow/checklist.md | 90 ---- .../modify-workflow/instructions.md | 327 ------------- .../autominator/modify-workflow/workflow.yaml | 30 -- .../optimize-workflow/checklist.md | 130 ----- .../optimize-workflow/instructions.md | 446 ------------------ .../optimize-workflow/workflow.yaml | 29 -- 16 files changed, 2825 deletions(-) delete mode 100644 src/modules/bmm/agents/autominator.agent.yaml delete mode 100644 src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md delete mode 100644 src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml delete mode 100644 src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml delete mode 100644 src/modules/bmm/workflows/autominator/create-workflow/checklist.md delete mode 100644 src/modules/bmm/workflows/autominator/create-workflow/instructions.md delete mode 100644 src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml delete mode 100644 src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md delete mode 100644 src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md delete mode 100644 src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml delete mode 100644 src/modules/bmm/workflows/autominator/modify-workflow/checklist.md delete mode 100644 src/modules/bmm/workflows/autominator/modify-workflow/instructions.md delete mode 100644 src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml delete mode 100644 src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md delete mode 100644 src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md delete mode 100644 src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml diff --git a/src/modules/bmm/agents/autominator.agent.yaml b/src/modules/bmm/agents/autominator.agent.yaml deleted file mode 100644 index fcd25014..00000000 --- a/src/modules/bmm/agents/autominator.agent.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Autominator - Arnold the Automation Expert - -agent: - webskip: true - metadata: - id: "{bmad_folder}/bmm/agents/autominator.md" - name: Arnold - title: Arnold the Autominator - icon: 🦾 - module: bmm - - persona: - role: n8n Workflow Automation Specialist - identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. - communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. Direct, confident, and results-focused. - principles: | - - Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations. - - Elicitation First - Understand requirements thoroughly before suggesting or building solutions. - - Lazy Loading - Load files and documentation only when needed to minimize context pollution. - - Validation - Always validate workflow JSON syntax after creation. - - Platform Agnostic - Support migration from any automation platform with proper mapping. - - Error Recovery - NEVER delete files due to syntax errors, always fix them using error location information. - - Structured Approach - Follow task-specific workflows for different automation scenarios. - - menu: - - trigger: create-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/create-workflow/workflow.yaml" - description: Create new n8n workflow from scratch based on requirements - - - trigger: modify-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/modify-workflow/workflow.yaml" - description: Edit or update existing n8n workflow - - - trigger: migrate-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/migrate-workflow/workflow.yaml" - description: Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n - - - trigger: optimize-workflow - workflow: "{project-root}/{bmad_folder}/bmm/workflows/autominator/optimize-workflow/workflow.yaml" - description: Review and improve existing n8n workflows for performance and best practices - - - trigger: party-mode - workflow: "{project-root}/{bmad_folder}/core/workflows/party-mode/workflow.yaml" - description: Bring the whole team in to chat with other expert agents from the party diff --git a/src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md b/src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md deleted file mode 100644 index d46aa1d6..00000000 --- a/src/modules/bmm/workflows/autominator/_shared/n8n-helpers.md +++ /dev/null @@ -1,201 +0,0 @@ -# n8n Workflow Helpers - -## Node Creation Guidelines - -### Basic Node Structure - -```json -{ - "id": "unique-node-id", - "name": "Node Name", - "type": "n8n-nodes-base.nodeName", - "typeVersion": 1, - "position": [x, y], - "parameters": {}, - "credentials": {} -} -``` - -### Node Positioning - -- Start node: [250, 300] -- Horizontal spacing: 220px between nodes -- Vertical spacing: 100px for parallel branches -- Grid alignment: Snap to 20px grid for clean layout - -### Common Node Types - -**Trigger Nodes:** - -- `n8n-nodes-base.webhook` - HTTP webhook trigger -- `n8n-nodes-base.scheduleTrigger` - Cron/interval trigger -- `n8n-nodes-base.manualTrigger` - Manual execution trigger -- `n8n-nodes-base.emailTrigger` - Email trigger - -**Action Nodes:** - -- `n8n-nodes-base.httpRequest` - HTTP API calls -- `n8n-nodes-base.set` - Data transformation -- `n8n-nodes-base.code` - Custom JavaScript/Python code -- `n8n-nodes-base.if` - Conditional branching -- `n8n-nodes-base.merge` - Merge data from multiple branches -- `n8n-nodes-base.splitInBatches` - Process data in batches - -**Integration Nodes:** - -- `n8n-nodes-base.googleSheets` - Google Sheets -- `n8n-nodes-base.slack` - Slack -- `n8n-nodes-base.notion` - Notion -- `n8n-nodes-base.airtable` - Airtable -- `n8n-nodes-base.postgres` - PostgreSQL -- `n8n-nodes-base.mysql` - MySQL - -## Connection Guidelines - -### Connection Structure - -```json -{ - "node": "Source Node Name", - "type": "main", - "index": 0 -} -``` - -### Connection Rules - -1. Each connection has a source node and target node -2. Main connections use type: "main" -3. Index 0 is default output, index 1+ for conditional branches -4. IF nodes have index 0 (true) and index 1 (false) -5. Always validate that referenced node names exist - -### Connection Patterns - -**Linear Flow:** - -``` -Trigger → Action1 → Action2 → End -``` - -**Conditional Branch:** - -``` -Trigger → IF Node → [true: Action1, false: Action2] → Merge -``` - -**Parallel Processing:** - -``` -Trigger → Split → [Branch1, Branch2, Branch3] → Merge -``` - -## Error Handling Best Practices - -### Error Workflow Pattern - -```json -{ - "name": "Error Handler", - "type": "n8n-nodes-base.errorTrigger", - "parameters": { - "errorWorkflows": ["workflow-id"] - } -} -``` - -### Retry Configuration - -```json -{ - "retryOnFail": true, - "maxTries": 3, - "waitBetweenTries": 1000 -} -``` - -## Data Transformation Patterns - -### Using Set Node - -```json -{ - "name": "Transform Data", - "type": "n8n-nodes-base.set", - "parameters": { - "mode": "manual", - "values": { - "string": [ - { - "name": "outputField", - "value": "={{ $json.inputField }}" - } - ] - } - } -} -``` - -### Using Code Node - -```json -{ - "name": "Custom Logic", - "type": "n8n-nodes-base.code", - "parameters": { - "language": "javaScript", - "jsCode": "return items.map(item => ({ json: { ...item.json, processed: true } }));" - } -} -``` - -## Credentials Management - -### Credential Reference - -```json -{ - "credentials": { - "httpBasicAuth": { - "id": "credential-id", - "name": "My API Credentials" - } - } -} -``` - -### Common Credential Types - -- `httpBasicAuth` - Basic authentication -- `oAuth2Api` - OAuth2 -- `httpHeaderAuth` - Header-based auth -- `httpQueryAuth` - Query parameter auth - -## Workflow Metadata - -### Required Fields - -```json -{ - "name": "Workflow Name", - "nodes": [], - "connections": {}, - "active": false, - "settings": { - "executionOrder": "v1" - }, - "tags": [] -} -``` - -## Validation Checklist - -- [ ] All node IDs are unique -- [ ] All node names are unique -- [ ] All connections reference existing nodes -- [ ] Trigger node exists and is properly configured -- [ ] Node positions don't overlap -- [ ] Required parameters are set for each node -- [ ] Credentials are properly referenced -- [ ] Error handling is configured where needed -- [ ] JSON syntax is valid diff --git a/src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml b/src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml deleted file mode 100644 index 6e3ee4b1..00000000 --- a/src/modules/bmm/workflows/autominator/_shared/n8n-templates.yaml +++ /dev/null @@ -1,299 +0,0 @@ -# n8n Workflow Templates - -# Basic webhook workflow template -webhook_workflow: - name: "Webhook Workflow" - nodes: - - id: "webhook_trigger" - name: "Webhook" - type: "n8n-nodes-base.webhook" - typeVersion: 1 - position: [250, 300] - parameters: - httpMethod: "POST" - path: "webhook-path" - responseMode: "onReceived" - - id: "process_data" - name: "Process Data" - type: "n8n-nodes-base.set" - typeVersion: 1 - position: [470, 300] - parameters: - mode: "manual" - values: {} - connections: - Webhook: - - - node: "Process Data" - type: "main" - index: 0 - -# Scheduled workflow template -scheduled_workflow: - name: "Scheduled Workflow" - nodes: - - id: "schedule_trigger" - name: "Schedule Trigger" - type: "n8n-nodes-base.scheduleTrigger" - typeVersion: 1 - position: [250, 300] - parameters: - rule: - interval: - - field: "hours" - hoursInterval: 1 - - id: "execute_action" - name: "Execute Action" - type: "n8n-nodes-base.httpRequest" - typeVersion: 1 - position: [470, 300] - parameters: - method: "GET" - url: "" - connections: - Schedule Trigger: - - - node: "Execute Action" - type: "main" - index: 0 - -# Conditional workflow template -conditional_workflow: - name: "Conditional Workflow" - nodes: - - id: "manual_trigger" - name: "Manual Trigger" - type: "n8n-nodes-base.manualTrigger" - typeVersion: 1 - position: [250, 300] - parameters: {} - - id: "if_condition" - name: "IF" - type: "n8n-nodes-base.if" - typeVersion: 1 - position: [470, 300] - parameters: - conditions: - boolean: [] - number: [] - string: [] - - id: "true_branch" - name: "True Branch" - type: "n8n-nodes-base.noOp" - typeVersion: 1 - position: [690, 200] - parameters: {} - - id: "false_branch" - name: "False Branch" - type: "n8n-nodes-base.noOp" - typeVersion: 1 - position: [690, 400] - parameters: {} - connections: - Manual Trigger: - - - node: "IF" - type: "main" - index: 0 - IF: - - - node: "True Branch" - type: "main" - index: 0 - - - node: "False Branch" - type: "main" - index: 0 - -# API integration workflow template -api_integration_workflow: - name: "API Integration Workflow" - nodes: - - id: "webhook_trigger" - name: "Webhook" - type: "n8n-nodes-base.webhook" - typeVersion: 1 - position: [250, 300] - parameters: - httpMethod: "POST" - path: "api-webhook" - responseMode: "onReceived" - - id: "http_request" - name: "HTTP Request" - type: "n8n-nodes-base.httpRequest" - typeVersion: 1 - position: [470, 300] - parameters: - method: "POST" - url: "" - jsonParameters: true - options: {} - - id: "transform_response" - name: "Transform Response" - type: "n8n-nodes-base.set" - typeVersion: 1 - position: [690, 300] - parameters: - mode: "manual" - values: {} - connections: - Webhook: - - - node: "HTTP Request" - type: "main" - index: 0 - HTTP Request: - - - node: "Transform Response" - type: "main" - index: 0 - -# Database workflow template -database_workflow: - name: "Database Workflow" - nodes: - - id: "schedule_trigger" - name: "Schedule Trigger" - type: "n8n-nodes-base.scheduleTrigger" - typeVersion: 1 - position: [250, 300] - parameters: - rule: - interval: - - field: "minutes" - minutesInterval: 15 - - id: "postgres_query" - name: "Postgres" - type: "n8n-nodes-base.postgres" - typeVersion: 1 - position: [470, 300] - parameters: - operation: "executeQuery" - query: "" - - id: "process_results" - name: "Process Results" - type: "n8n-nodes-base.code" - typeVersion: 1 - position: [690, 300] - parameters: - language: "javaScript" - jsCode: "return items;" - connections: - Schedule Trigger: - - - node: "Postgres" - type: "main" - index: 0 - Postgres: - - - node: "Process Results" - type: "main" - index: 0 - -# Error handling workflow template -error_handling_workflow: - name: "Error Handling Workflow" - nodes: - - id: "manual_trigger" - name: "Manual Trigger" - type: "n8n-nodes-base.manualTrigger" - typeVersion: 1 - position: [250, 300] - parameters: {} - - id: "risky_operation" - name: "Risky Operation" - type: "n8n-nodes-base.httpRequest" - typeVersion: 1 - position: [470, 300] - parameters: - method: "GET" - url: "" - continueOnFail: true - retryOnFail: true - maxTries: 3 - waitBetweenTries: 1000 - - id: "check_error" - name: "Check for Error" - type: "n8n-nodes-base.if" - typeVersion: 1 - position: [690, 300] - parameters: - conditions: - boolean: - - value1: "={{ $json.error !== undefined }}" - value2: true - - id: "handle_error" - name: "Handle Error" - type: "n8n-nodes-base.set" - typeVersion: 1 - position: [910, 200] - parameters: - mode: "manual" - values: - string: - - name: "status" - value: "error" - - id: "success_path" - name: "Success Path" - type: "n8n-nodes-base.noOp" - typeVersion: 1 - position: [910, 400] - parameters: {} - connections: - Manual Trigger: - - - node: "Risky Operation" - type: "main" - index: 0 - Risky Operation: - - - node: "Check for Error" - type: "main" - index: 0 - Check for Error: - - - node: "Handle Error" - type: "main" - index: 0 - - - node: "Success Path" - type: "main" - index: 0 - -# Batch processing workflow template -batch_processing_workflow: - name: "Batch Processing Workflow" - nodes: - - id: "manual_trigger" - name: "Manual Trigger" - type: "n8n-nodes-base.manualTrigger" - typeVersion: 1 - position: [250, 300] - parameters: {} - - id: "get_data" - name: "Get Data" - type: "n8n-nodes-base.httpRequest" - typeVersion: 1 - position: [470, 300] - parameters: - method: "GET" - url: "" - - id: "split_batches" - name: "Split In Batches" - type: "n8n-nodes-base.splitInBatches" - typeVersion: 1 - position: [690, 300] - parameters: - batchSize: 10 - - id: "process_batch" - name: "Process Batch" - type: "n8n-nodes-base.code" - typeVersion: 1 - position: [910, 300] - parameters: - language: "javaScript" - jsCode: "return items;" - connections: - Manual Trigger: - - - node: "Get Data" - type: "main" - index: 0 - Get Data: - - - node: "Split In Batches" - type: "main" - index: 0 - Split In Batches: - - - node: "Process Batch" - type: "main" - index: 0 - Process Batch: - - - node: "Split In Batches" - type: "main" - index: 0 diff --git a/src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml b/src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml deleted file mode 100644 index 059bed6c..00000000 --- a/src/modules/bmm/workflows/autominator/_shared/platform-mappings.yaml +++ /dev/null @@ -1,282 +0,0 @@ -# Platform Migration Mappings -# Maps common automation platform concepts to n8n equivalents - -# Zapier to n8n mappings -zapier: - triggers: - "New Email": - n8n_node: "n8n-nodes-base.emailTrigger" - notes: "Configure IMAP/POP3 credentials" - "Webhook": - n8n_node: "n8n-nodes-base.webhook" - notes: "Use POST method by default" - "Schedule": - n8n_node: "n8n-nodes-base.scheduleTrigger" - notes: "Convert Zapier schedule format to cron" - "New Row in Google Sheets": - n8n_node: "n8n-nodes-base.googleSheetsTrigger" - notes: "Requires Google OAuth credentials" - "New Slack Message": - n8n_node: "n8n-nodes-base.slackTrigger" - notes: "Configure channel and event type" - - actions: - "Send Email": - n8n_node: "n8n-nodes-base.emailSend" - notes: "Configure SMTP credentials" - "HTTP Request": - n8n_node: "n8n-nodes-base.httpRequest" - notes: "Map method, URL, headers, and body" - "Create Google Sheets Row": - n8n_node: "n8n-nodes-base.googleSheets" - parameters: - operation: "append" - "Send Slack Message": - n8n_node: "n8n-nodes-base.slack" - parameters: - operation: "post" - resource: "message" - "Delay": - n8n_node: "n8n-nodes-base.wait" - notes: "Convert delay duration to milliseconds" - "Filter": - n8n_node: "n8n-nodes-base.if" - notes: "Convert filter conditions to IF node logic" - "Formatter": - n8n_node: "n8n-nodes-base.set" - notes: "Use Set node for data transformation" - "Code": - n8n_node: "n8n-nodes-base.code" - notes: "JavaScript or Python code execution" - - concepts: - "Multi-step Zap": - n8n_equivalent: "Linear workflow with connected nodes" - "Paths": - n8n_equivalent: "IF node with multiple branches" - "Filters": - n8n_equivalent: "IF node with conditions" - "Formatter": - n8n_equivalent: "Set node or Code node" - "Looping": - n8n_equivalent: "Split In Batches node" - -# Make (Integromat) to n8n mappings -make: - triggers: - "Webhook": - n8n_node: "n8n-nodes-base.webhook" - notes: "Direct equivalent" - "Watch Records": - n8n_node: "n8n-nodes-base.scheduleTrigger" - notes: "Combine with polling logic in Code node" - "Custom Webhook": - n8n_node: "n8n-nodes-base.webhook" - notes: "Configure response mode" - - actions: - "HTTP Request": - n8n_node: "n8n-nodes-base.httpRequest" - notes: "Map all HTTP parameters" - "Router": - n8n_node: "n8n-nodes-base.switch" - notes: "Multiple conditional branches" - "Iterator": - n8n_node: "n8n-nodes-base.splitInBatches" - notes: "Process array items individually" - "Aggregator": - n8n_node: "n8n-nodes-base.merge" - notes: "Combine data from multiple sources" - "Data Store": - n8n_node: "n8n-nodes-base.redis" - notes: "Use Redis or database node for storage" - "JSON Parser": - n8n_node: "n8n-nodes-base.code" - notes: "Parse JSON in Code node" - "Text Parser": - n8n_node: "n8n-nodes-base.set" - notes: "Use expressions for text manipulation" - - concepts: - "Scenario": - n8n_equivalent: "Workflow" - "Module": - n8n_equivalent: "Node" - "Route": - n8n_equivalent: "Connection" - "Filter": - n8n_equivalent: "IF node" - "Router": - n8n_equivalent: "Switch node or multiple IF nodes" - "Iterator": - n8n_equivalent: "Split In Batches node" - "Aggregator": - n8n_equivalent: "Merge node" - -# HubSpot Workflows to n8n mappings -hubspot: - triggers: - "Contact Property Change": - n8n_node: "n8n-nodes-base.hubspotTrigger" - notes: "Configure webhook for property updates" - "Deal Stage Change": - n8n_node: "n8n-nodes-base.hubspotTrigger" - notes: "Monitor deal pipeline changes" - "Form Submission": - n8n_node: "n8n-nodes-base.hubspotTrigger" - notes: "Webhook for form submissions" - "List Membership": - n8n_node: "n8n-nodes-base.scheduleTrigger" - notes: "Poll HubSpot API for list changes" - - actions: - "Update Contact Property": - n8n_node: "n8n-nodes-base.hubspot" - parameters: - resource: "contact" - operation: "update" - "Create Deal": - n8n_node: "n8n-nodes-base.hubspot" - parameters: - resource: "deal" - operation: "create" - "Send Email": - n8n_node: "n8n-nodes-base.hubspot" - parameters: - resource: "email" - operation: "send" - "Add to List": - n8n_node: "n8n-nodes-base.hubspot" - parameters: - resource: "contact" - operation: "addToList" - "Create Task": - n8n_node: "n8n-nodes-base.hubspot" - parameters: - resource: "task" - operation: "create" - - concepts: - "Enrollment Trigger": - n8n_equivalent: "Trigger node (webhook or schedule)" - "If/Then Branch": - n8n_equivalent: "IF node" - "Delay": - n8n_equivalent: "Wait node" - "Goal": - n8n_equivalent: "IF node checking completion criteria" - "Re-enrollment": - n8n_equivalent: "Workflow settings with loop detection" - -# Microsoft Power Automate to n8n mappings -power_automate: - triggers: - "When an item is created": - n8n_node: "n8n-nodes-base.webhook" - notes: "Configure webhook for item creation events" - "Recurrence": - n8n_node: "n8n-nodes-base.scheduleTrigger" - notes: "Convert recurrence pattern to cron" - "When a HTTP request is received": - n8n_node: "n8n-nodes-base.webhook" - notes: "Direct equivalent" - - actions: - "HTTP": - n8n_node: "n8n-nodes-base.httpRequest" - notes: "Map all HTTP parameters" - "Condition": - n8n_node: "n8n-nodes-base.if" - notes: "Convert condition logic" - "Apply to each": - n8n_node: "n8n-nodes-base.splitInBatches" - notes: "Process array items" - "Compose": - n8n_node: "n8n-nodes-base.set" - notes: "Data transformation" - "Parse JSON": - n8n_node: "n8n-nodes-base.code" - notes: "Parse JSON in Code node" - "Delay": - n8n_node: "n8n-nodes-base.wait" - notes: "Convert delay duration" - - concepts: - "Flow": - n8n_equivalent: "Workflow" - "Action": - n8n_equivalent: "Node" - "Condition": - n8n_equivalent: "IF node" - "Switch": - n8n_equivalent: "Switch node" - "Scope": - n8n_equivalent: "Error handling with try/catch in Code node" - "Apply to each": - n8n_equivalent: "Split In Batches node" - -# Common patterns across platforms -common_patterns: - conditional_logic: - description: "If/then/else branching" - n8n_implementation: "IF node with true/false branches" - - loops: - description: "Iterate over array items" - n8n_implementation: "Split In Batches node" - - data_transformation: - description: "Transform, format, or map data" - n8n_implementation: "Set node or Code node" - - error_handling: - description: "Handle errors and retries" - n8n_implementation: "Node settings: continueOnFail, retryOnFail, maxTries" - - delays: - description: "Wait before next action" - n8n_implementation: "Wait node with duration" - - webhooks: - description: "Receive HTTP requests" - n8n_implementation: "Webhook node with response configuration" - - api_calls: - description: "Make HTTP requests to APIs" - n8n_implementation: "HTTP Request node" - - parallel_execution: - description: "Execute multiple actions simultaneously" - n8n_implementation: "Multiple connections from single node" - - merge_data: - description: "Combine data from multiple sources" - n8n_implementation: "Merge node" - -# Migration considerations -migration_notes: - authentication: - - "Recreate all credentials in n8n" - - "OAuth flows may need re-authorization" - - "API keys and tokens must be securely stored" - - scheduling: - - "Convert platform-specific schedules to cron expressions" - - "Consider timezone differences" - - "Test schedule triggers before going live" - - data_formats: - - "Verify JSON structure compatibility" - - "Check date/time format conversions" - - "Validate data type mappings" - - error_handling: - - "Implement retry logic where needed" - - "Add error notification workflows" - - "Test failure scenarios" - - testing: - - "Test with sample data first" - - "Verify all integrations work correctly" - - "Monitor initial executions closely" - - "Compare outputs with original platform" diff --git a/src/modules/bmm/workflows/autominator/create-workflow/checklist.md b/src/modules/bmm/workflows/autominator/create-workflow/checklist.md deleted file mode 100644 index dcd96098..00000000 --- a/src/modules/bmm/workflows/autominator/create-workflow/checklist.md +++ /dev/null @@ -1,74 +0,0 @@ -# Create n8n Workflow - Validation Checklist - -## Workflow Structure - -- [ ] Workflow has a valid name -- [ ] Workflow contains at least one trigger node -- [ ] All nodes have unique IDs -- [ ] All nodes have unique names -- [ ] Workflow JSON is valid and parseable - -## Node Configuration - -- [ ] Trigger node is properly configured -- [ ] All action nodes have required parameters set -- [ ] Node types are valid n8n node types -- [ ] Node positions are set and don't overlap -- [ ] TypeVersion is set for all nodes (usually 1) - -## Connections - -- [ ] All nodes are connected (no orphaned nodes except trigger) -- [ ] All connections reference existing node names -- [ ] Connection types are set correctly (usually "main") -- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) -- [ ] No circular dependencies (unless intentional loops) - -## Error Handling - -- [ ] Error handling strategy matches requirements -- [ ] Critical nodes have retry logic if needed -- [ ] continueOnFail is set appropriately -- [ ] maxTries and waitBetweenTries are configured if retries enabled - -## Data Flow - -- [ ] Data transformations are properly configured -- [ ] Set nodes have correct value mappings -- [ ] Code nodes have valid JavaScript/Python code -- [ ] Expressions use correct n8n syntax (={{ }}) - -## Integrations - -- [ ] All required integrations are included -- [ ] Credential placeholders are set for authenticated services -- [ ] API endpoints and methods are correct -- [ ] Request/response formats are properly configured - -## Best Practices - -- [ ] Workflow follows n8n naming conventions -- [ ] Nodes are logically organized and positioned -- [ ] Complex logic is broken into manageable steps -- [ ] Workflow is documented (node names are descriptive) - -## Testing Readiness - -- [ ] Workflow can be imported into n8n without errors -- [ ] All required credentials are identified -- [ ] Test data requirements are clear -- [ ] Expected outputs are defined - -## File Output - -- [ ] File is saved to correct location -- [ ] File has .json extension -- [ ] File is valid JSON (passes JSON.parse) -- [ ] File size is reasonable (not corrupted) - -## Documentation - -- [ ] User has been informed how to import workflow -- [ ] Credential requirements have been communicated -- [ ] Testing instructions have been provided -- [ ] Any special configuration notes have been shared diff --git a/src/modules/bmm/workflows/autominator/create-workflow/instructions.md b/src/modules/bmm/workflows/autominator/create-workflow/instructions.md deleted file mode 100644 index 161ddb27..00000000 --- a/src/modules/bmm/workflows/autominator/create-workflow/instructions.md +++ /dev/null @@ -1,350 +0,0 @@ -# Create n8n Workflow - Workflow Instructions - -```xml -The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml -You MUST have already loaded and processed: {installed_path}/workflow.yaml -This workflow creates a new n8n workflow from scratch based on user requirements. - - - - - Before asking any questions, analyze what the user has already told you - - Review the user's initial request and conversation history - Extract any mentioned: workflow type, trigger, integrations, complexity, requirements - - - Summarize your understanding - Skip directly to Step 2 (Check Context7 MCP) - - - - Note what you already know - Only ask about missing information in Step 1 - - - - Proceed with full elicitation in Step 1 - - - - - Ask Question 1: "What type of automation workflow do you need?" - Present numbered options: - 1. Webhook-based - Receive HTTP requests and process data - 2. Scheduled - Run on a schedule (cron/interval) - 3. Event-driven - Trigger from external service events - 4. Manual - Execute on demand - 5. Database-driven - Trigger from database changes - 6. Other - Describe your specific trigger needs - - WAIT for user selection (1-6) - Store selection in {{workflow_type}} - - - Ask: "Please describe your trigger requirements" - WAIT for user input - Store in {{workflow_type}} - - - Ask Question 2: "What integrations or services will this workflow use?" - Present numbered options: - 1. HTTP/REST APIs - Generic API calls - 2. Databases - PostgreSQL, MySQL, MongoDB, etc. - 3. Cloud Services - Google Sheets, Slack, Notion, Airtable - 4. Email - Send/receive emails - 5. CRM - HubSpot, Salesforce, etc. - 6. Custom Code - JavaScript/Python logic - 7. Multiple - Combination of above - 8. Other - Specify integrations - - WAIT for user selection (1-8) - Store selection in {{integrations}} - - - Ask: "Please list all integrations needed (comma-separated)" - WAIT for user input - Store in {{integrations}} - - - Ask Question 3: "How complex is your workflow logic?" - Present numbered options: - 1. Simple (3-5 nodes) - Linear flow with minimal logic - 2. Medium (6-10 nodes) - Some conditional logic or branching - 3. Complex (11-20 nodes) - Multiple branches, loops, or error handling - 4. Very Complex (20+ nodes) - Advanced logic with parallel processing - - WAIT for user selection (1-4) - Store selection in {{complexity}} - - Ask Question 4: "Do you need error handling and retry logic?" - Present numbered options: - 1. No - Simple workflow without error handling - 2. Basic - Retry failed operations automatically - 3. Advanced - Custom error handling with notifications - 4. Comprehensive - Full error workflow with logging and alerts - - WAIT for user selection (1-4) - Store selection in {{error_handling}} - - Ask Question 5: "What should the workflow be named?" - WAIT for user input - Store in {{workflow_name}} - - Ask Question 6: "Where should the workflow file be saved?" - Present numbered options: - 1. Default location - workflows/[workflow-name].json - 2. Custom path - Specify your own file path - 3. Project root - Save in main project directory - 4. Specific folder - Choose from existing folders - - WAIT for user selection (1-4) - - Ask for specific path - WAIT for user input - - Store final path in {{save_location}} - - Ask Question 7: "Any additional requirements or specific logic needed?" - Present numbered options: - 1. No - Proceed with current requirements - 2. Yes - Describe additional requirements - - WAIT for user selection (1-2) - - Ask: "Please describe additional requirements" - WAIT for user input - Store in {{additional_requirements}} - - - - - Check if Context7 MCP server is configured - Try to list available MCP tools - - - Store true in {{context7_available}} - Proceed to Step 3 - - - - Store false in {{context7_available}} - Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation." - Ask: "Would you like help setting up Context7 MCP? (yes/no)" - WAIT for user response - - - Guide user through Context7 MCP setup: - 1. Inform user: "Context7 MCP requires the 'uvx' command (part of uv Python package manager)" - 2. Ask: "Do you have 'uv' installed? (yes/no/not sure)" - WAIT for response - - - Provide installation guidance: - - macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh - - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" - - Or via pip: pip install uv - Ask user to install and confirm when ready - WAIT for confirmation - - - 3. Inform user: "Please configure Context7 MCP in your IDE's MCP settings with:" - - Server name: context7 - Command: uvx - Args: ["context7"] - Auto-approve tools: ["resolve-library-id", "get-library-docs"] - - 4. Ask user to reconnect/restart MCP servers in their IDE - 5. Wait for user confirmation that MCP is reconnected - 6. Verify Context7 is now available - Store result in {{context7_available}} - - - - Inform: "Proceeding without Context7. Using built-in n8n knowledge." - Proceed to Step 4 - - - - - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Workflow type: {{workflow_type}} - - Integrations: {{integrations}} - - Complexity: {{complexity}} - Store relevant documentation snippets for reference - - - - Skip Context7 query - Use built-in knowledge and templates - - - - - Based on gathered requirements, plan the workflow structure: - 1. Identify trigger node type - 2. List all action nodes needed - 3. Identify conditional logic (IF nodes) - 4. Plan data transformations (Set/Code nodes) - 5. Design error handling strategy - 6. Map node connections - - Present the planned structure to user in clear format: - - Trigger: [trigger type] - - Nodes: [list of nodes with descriptions] - - Logic: [conditional branches, loops] - - Error Handling: [strategy] - - Ask: "Does this structure meet your needs?" - Present numbered options: - 1. Yes - Proceed with this structure - 2. No - Adjust the structure - 3. Add more details - Provide additional requirements - - WAIT for user selection (1-3) - - - Ask: "What changes or additions are needed?" - WAIT for user input - Adjust structure based on feedback - Repeat this step - - - - - Load {{templates}} file - Identify closest matching template based on workflow type - Load {{helpers}} for node creation guidelines - Extract relevant template sections - - - - Follow guidelines from {{helpers}} for proper node creation - - Initialize workflow structure: - - { - "name": "{{workflow_name}}", - "nodes": [], - "connections": {}, - "active": false, - "settings": { - "executionOrder": "v1" - }, - "tags": [] - } - - - Build nodes ONE at a time following these rules: - - For Each Node: - 1. Generate unique node ID - 2. Set node name (unique, descriptive) - 3. Set node type (e.g., n8n-nodes-base.webhook) - 4. Set typeVersion (usually 1) - 5. Calculate position: - - First node (trigger): [250, 300] - - Subsequent nodes: add 220 to x for each step - - Branches: adjust y by ±100 - 6. Configure parameters based on node type - 7. Add credentials if needed - 8. Set error handling options if required: - - continueOnFail: true/false - - retryOnFail: true/false - - maxTries: number - - waitBetweenTries: milliseconds - - - For Each Connection: - 1. Identify source node name - 2. Identify target node name - 3. Create connection entry in connections object: - "Source Node Name": [ - [ - { - "node": "Target Node Name", - "type": "main", - "index": 0 - } - ] - ] - 4. For IF nodes: - - index 0 = true branch - - index 1 = false branch - 5. Validate all referenced nodes exist - - - Node Building Order: - 1. Trigger node - 2. Main flow action nodes - 3. Conditional nodes (IF/Switch) - 4. Branch nodes - 5. Merge nodes - 6. Final action nodes - 7. Connect all nodes - - - Apply error handling based on {{error_handling}} selection - Validate all node IDs are unique - Validate all node names are unique - Validate all connections reference existing nodes - - - - Review workflow for optimization: - - Remove any unused nodes - - Verify node positions don't overlap - - Ensure proper spacing and alignment - - Validate all required parameters are set - - Save workflow to {{save_location}} - - - - NEVER delete the file if validation fails - always fix syntax errors - - Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" - - - Read the error message carefully - it shows the syntax error and position - Open the file and navigate to the error location - Fix the syntax error (add missing comma, bracket, or quote as indicated) - Save the file - Re-run validation with the same command - Repeat until validation passes - - - Once validation passes, confirm with user: "n8n workflow created at {{save_location}}" - - - - Inform user how to use the workflow: - 1. Import the JSON file into n8n - 2. Configure credentials for integrated services - 3. Test the workflow with sample data - 4. Activate the workflow when ready - - Ask: "Would you like me to explain any part of the workflow?" - Present numbered options: - 1. No - I'm good to go - 2. Yes - Explain specific nodes - 3. Yes - Explain the overall flow - 4. Yes - Explain how to test it - - WAIT for user selection (1-4) - - - Provide requested explanation - - - - - Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml - - - -``` diff --git a/src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml deleted file mode 100644 index 63ad6e15..00000000 --- a/src/modules/bmm/workflows/autominator/create-workflow/workflow.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: create-workflow -description: "Create new n8n workflow from scratch based on requirements" -author: "Saif" - -# Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/create-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" -instructions: "{installed_path}/instructions.md" -validation: "{installed_path}/checklist.md" - -# Shared resources -helpers: "{shared_path}/n8n-helpers.md" -templates: "{shared_path}/n8n-templates.yaml" -platform_mappings: "{shared_path}/platform-mappings.yaml" - -# Variables -variables: - workflow_type: "" # Will be elicited - trigger_type: "" # Will be elicited - integrations: [] # Will be elicited - complexity: "" # Will be elicited - error_handling: "" # Will be elicited - save_location: "" # Will be elicited - workflow_name: "" # Will be elicited - additional_requirements: "" # Will be elicited - context7_available: false # Will be checked - -default_output_file: "{project-root}/workflows/workflow-{timestamp}.json" - -standalone: true -web_bundle: false diff --git a/src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md b/src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md deleted file mode 100644 index 22e6e675..00000000 --- a/src/modules/bmm/workflows/autominator/migrate-workflow/checklist.md +++ /dev/null @@ -1,110 +0,0 @@ -# Migrate Workflow to n8n - Validation Checklist - -## Source Analysis - -- [ ] Source platform was identified -- [ ] Source workflow details were gathered -- [ ] Trigger type was identified -- [ ] All integrations were identified -- [ ] Workflow complexity was assessed - -## Platform Mapping - -- [ ] Platform mappings were loaded -- [ ] Source trigger was mapped to n8n trigger -- [ ] All source actions were mapped to n8n nodes -- [ ] Conditional logic was mapped correctly -- [ ] Loops/iterations were mapped correctly -- [ ] Data transformations were identified - -## Workflow Structure - -- [ ] n8n workflow has valid JSON structure -- [ ] Workflow name is set -- [ ] Migration tag is added (migrated-from-[platform]) -- [ ] All nodes have unique IDs -- [ ] All nodes have unique names -- [ ] Trigger node is properly configured - -## Node Configuration - -- [ ] All mapped nodes are created -- [ ] Node types are valid n8n types -- [ ] Node parameters are configured -- [ ] Credentials placeholders are set -- [ ] Node positions are calculated correctly -- [ ] No overlapping nodes - -## Data Mappings - -- [ ] Field mappings from source to n8n are correct -- [ ] Data type conversions are handled -- [ ] Date/time format differences are addressed -- [ ] Expressions use correct n8n syntax (={{ }}) -- [ ] Set nodes are used for simple transformations -- [ ] Code nodes are used for complex transformations - -## Conditional Logic - -- [ ] IF nodes are created for conditional branches -- [ ] Switch nodes are created for multiple conditions -- [ ] Conditions are properly configured -- [ ] True/false branches are correct (index 0/1) -- [ ] All branches are connected - -## Connections - -- [ ] All nodes are connected properly -- [ ] Trigger connects to first action -- [ ] Actions are connected in sequence -- [ ] Conditional branches are connected -- [ ] Merge points are connected -- [ ] All connections reference existing nodes -- [ ] No orphaned nodes (except trigger) - -## Error Handling - -- [ ] Error handling strategy is defined -- [ ] Critical nodes have retry logic if needed -- [ ] continueOnFail is set appropriately -- [ ] Error handling matches or improves on source - -## Migration Notes - -- [ ] Source platform is documented -- [ ] Migration date is recorded -- [ ] Credentials needed are listed -- [ ] Platform-specific differences are noted -- [ ] Testing considerations are documented - -## Validation - -- [ ] Workflow passes JSON validation -- [ ] All required parameters are set -- [ ] Workflow structure is logical -- [ ] Migration matches source workflow functionality - -## Credentials & Authentication - -- [ ] All services requiring credentials are identified -- [ ] Credential types are correct for n8n -- [ ] OAuth requirements are noted -- [ ] API key requirements are noted -- [ ] Authentication differences from source are documented - -## Testing Readiness - -- [ ] Workflow can be imported into n8n -- [ ] Test data requirements are clear -- [ ] Expected outputs are defined -- [ ] Comparison approach with source is defined -- [ ] Initial monitoring plan is suggested - -## Documentation - -- [ ] User has import instructions -- [ ] Credential setup guidance provided -- [ ] Data mapping explanations provided -- [ ] Testing approach explained -- [ ] Platform differences highlighted -- [ ] Post-migration checklist provided diff --git a/src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md b/src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md deleted file mode 100644 index 17ffd53d..00000000 --- a/src/modules/bmm/workflows/autominator/migrate-workflow/instructions.md +++ /dev/null @@ -1,350 +0,0 @@ -# Migrate Workflow to n8n - Workflow Instructions - -```xml -The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml -You MUST have already loaded and processed: {installed_path}/workflow.yaml -This workflow migrates automation workflows from other platforms to n8n. - - - - - Before asking any questions, analyze what the user has already told you - - Review the user's initial request and conversation history - Extract any mentioned: source platform, workflow details, integrations, file paths - - - Summarize your understanding - Skip directly to Step 2 (Check Context7 MCP) - - - - Note what you already know - Only ask about missing information in Step 1 - - - - Proceed with full elicitation in Step 1 - - - - - Ask Question 1: "Which platform are you migrating from?" - Present numbered options: - 1. Zapier - Migrate Zapier Zaps to n8n - 2. Make (Integromat) - Migrate Make scenarios to n8n - 3. HubSpot Workflows - Migrate HubSpot workflows to n8n - 4. Microsoft Power Automate - Migrate Power Automate flows to n8n - 5. IFTTT - Migrate IFTTT applets to n8n - 6. Other - Specify another automation platform - - WAIT for user selection (1-6) - Store selection in {{source_platform}} - - - Ask: "Please specify the platform you're migrating from" - WAIT for user input - Store in {{source_platform}} - - - Ask Question 2: "How will you provide the workflow to migrate?" - Present numbered options: - 1. Describe it - Explain what the workflow does - 2. Provide export file - Upload/paste workflow export file - 3. Provide screenshots - Share workflow screenshots - 4. Provide documentation - Share workflow documentation - - WAIT for user selection (1-4) - - - Ask: "Please describe what the workflow does (trigger, actions, logic)" - WAIT for user input - Store in {{workflow_description}} - - - - Ask: "Please provide the workflow export file path or paste the content" - WAIT for user input - Store in {{workflow_file}} or {{workflow_content}} - - - - Ask: "Please share the workflow screenshots and describe the flow" - WAIT for user input - Store in {{workflow_description}} - - - - Ask: "Please provide the workflow documentation" - WAIT for user input - Store in {{workflow_description}} - - - Ask Question 3: "What is the trigger for this workflow?" - Present numbered options: - 1. Webhook/HTTP Request - Triggered by incoming HTTP requests - 2. Schedule/Cron - Runs on a schedule - 3. Form Submission - Triggered by form submissions - 4. Database Change - Triggered by database events - 5. Email - Triggered by incoming emails - 6. Service Event - Triggered by external service (Slack, Google Sheets, etc.) - 7. Not sure - Will determine from workflow details - - WAIT for user selection (1-7) - Store selection in {{trigger_type}} - - Ask Question 4: "What integrations/services does this workflow use?" - Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)" - WAIT for user input - Store in {{integrations_used}} - - Ask Question 5: "How complex is the workflow?" - Present numbered options: - 1. Simple - Linear flow with 3-5 steps - 2. Medium - Some conditional logic, 6-10 steps - 3. Complex - Multiple branches, loops, 11-20 steps - 4. Very Complex - Advanced logic, 20+ steps - - WAIT for user selection (1-4) - Store selection in {{complexity}} - - Ask Question 6: "What should the migrated workflow be named?" - WAIT for user input - Store in {{workflow_name}} - - Ask Question 7: "Where should the n8n workflow file be saved?" - Present numbered options: - 1. Default location - workflows/[workflow-name].json - 2. Custom path - Specify your own file path - 3. Project root - Save in main project directory - - WAIT for user selection (1-3) - - Ask for specific path - WAIT for user input - - Store final path in {{save_location}} - - - - Check if Context7 MCP server is configured - Try to list available MCP tools - - - Store true in {{context7_available}} - Proceed to Step 3 - - - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge." - Proceed to Step 4 - - - - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Integrations used: {{integrations_used}} - - Trigger type: {{trigger_type}} - - Source platform: {{source_platform}} - Store relevant documentation snippets for reference - - - - - Load {{platform_mappings}} file - Extract mappings for {{source_platform}} - Identify equivalent n8n nodes for source platform components - - - - - Parse source workflow file/content - Extract workflow structure - - - Analyze workflow based on description and details: - 1. Identify trigger type and configuration - 2. List all actions/steps in order - 3. Identify conditional logic (if/then branches) - 4. Identify loops or iterations - 5. Identify data transformations - 6. Identify error handling - 7. Map integrations to n8n nodes - - Present analysis to user: - - Source trigger: [platform-specific trigger] - - n8n trigger: [mapped n8n node] - - Source actions: [list with platform names] - - n8n actions: [list with n8n node types] - - Logic: [conditional branches, loops] - - Transformations: [data mapping needs] - - - - Load {{helpers}} for node creation guidelines - Load {{templates}} for reference - - Design n8n workflow structure: - 1. Map source trigger to n8n trigger node - 2. Map each source action to n8n node(s) - 3. Convert conditional logic to IF/Switch nodes - 4. Convert loops to Split In Batches nodes - 5. Add Set/Code nodes for data transformations - 6. Plan node connections - 7. Add error handling where needed - - Present migration plan to user: - - n8n Trigger: [node type and configuration] - - n8n Nodes: [list with descriptions] - - Connections: [flow diagram] - - Data Mappings: [field mappings] - - Credentials Needed: [list of integrations requiring auth] - - Ask: "Does this migration plan look correct?" - Present numbered options: - 1. Yes - Proceed with migration - 2. No - Adjust the plan - 3. Add more details - Provide additional information - - WAIT for user selection (1-3) - - - Ask: "What changes or additions are needed?" - WAIT for user input - Adjust plan based on feedback - Repeat this step - - - - - Follow guidelines from {{helpers}} for proper node creation - - Initialize workflow structure: - - { - "name": "{{workflow_name}}", - "nodes": [], - "connections": {}, - "active": false, - "settings": { - "executionOrder": "v1" - }, - "tags": [ - { - "name": "migrated-from-{{source_platform}}" - } - ] - } - - - Build nodes ONE at a time: - - For Each Mapped Node: - 1. Generate unique node ID - 2. Set node name (descriptive, unique) - 3. Set node type from platform mappings - 4. Set typeVersion (usually 1) - 5. Calculate position (220px spacing) - 6. Configure parameters based on source workflow - 7. Map data fields from source to n8n format - 8. Add credentials placeholder if needed - 9. Set error handling if required - - - For Data Transformations: - 1. Identify field mappings needed - 2. Create Set nodes for simple mappings - 3. Create Code nodes for complex transformations - 4. Use n8n expressions: ={{ $json.fieldName }} - 5. Handle data type conversions - 6. Handle date/time format differences - - - For Conditional Logic: - 1. Create IF nodes for if/then branches - 2. Create Switch nodes for multiple conditions - 3. Map source conditions to n8n condition format - 4. Set up true/false branches (index 0/1) - - - For Connections: - 1. Connect trigger to first action - 2. Connect actions in sequence - 3. Connect conditional branches - 4. Connect merge points - 5. Validate all connections - - - Add migration notes as workflow tags - Validate all node IDs are unique - Validate all connections reference existing nodes - - - - Add comment nodes or documentation: - - Source platform: {{source_platform}} - - Migration date: {timestamp} - - Credentials to configure: [list] - - Testing notes: [important considerations] - - Platform-specific differences: [notes] - - - - Save workflow to {{save_location}} - - - - NEVER delete the file if validation fails - always fix syntax errors - - Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')" - - - Read the error message carefully - it shows the syntax error and position - Open the file and navigate to the error location - Fix the syntax error (add missing comma, bracket, or quote as indicated) - Save the file - Re-run validation with the same command - Repeat until validation passes - - - Once validation passes, confirm with user: "Workflow migrated successfully to {{save_location}}" - - - - Provide post-migration instructions: - 1. Import the JSON file into n8n - 2. Configure credentials for these services: [list] - 3. Review and update these data mappings: [list] - 4. Test with sample data before activating - 5. Compare outputs with original platform - 6. Monitor initial executions closely - - Highlight platform-specific differences: - - Authentication: [differences] - - Data formats: [differences] - - Scheduling: [differences] - - Error handling: [differences] - - Ask: "Would you like help with any specific part of the migration?" - Present numbered options: - 1. No - I'm ready to test - 2. Yes - Explain credential setup - 3. Yes - Explain data mappings - 4. Yes - Explain testing approach - - WAIT for user selection (1-4) - - - Provide requested explanation - - - - - Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml - - - -``` diff --git a/src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml deleted file mode 100644 index 7344191e..00000000 --- a/src/modules/bmm/workflows/autominator/migrate-workflow/workflow.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: migrate-workflow -description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n" -author: "Saif" - -# Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/migrate-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" -instructions: "{installed_path}/instructions.md" -validation: "{installed_path}/checklist.md" - -# Shared resources -helpers: "{shared_path}/n8n-helpers.md" -templates: "{shared_path}/n8n-templates.yaml" -platform_mappings: "{shared_path}/platform-mappings.yaml" - -# Variables -variables: - source_platform: "" # Will be elicited - workflow_description: "" # Will be elicited - workflow_file: "" # Will be elicited (optional) - workflow_content: "" # Will be elicited (optional) - integrations_used: [] # Will be elicited - trigger_type: "" # Will be elicited - complexity: "" # Will be elicited - save_location: "" # Will be elicited - workflow_name: "" # Will be elicited - context7_available: false # Will be checked - -default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json" - -standalone: true -web_bundle: false diff --git a/src/modules/bmm/workflows/autominator/modify-workflow/checklist.md b/src/modules/bmm/workflows/autominator/modify-workflow/checklist.md deleted file mode 100644 index 9534b32b..00000000 --- a/src/modules/bmm/workflows/autominator/modify-workflow/checklist.md +++ /dev/null @@ -1,90 +0,0 @@ -# Modify n8n Workflow - Validation Checklist - -## Pre-Modification - -- [ ] Original workflow file was successfully loaded -- [ ] Workflow JSON was valid before modifications -- [ ] Backup was created before making changes -- [ ] User requirements were clearly understood - -## Workflow Structure - -- [ ] Workflow maintains valid JSON structure -- [ ] Workflow name is preserved (unless intentionally changed) -- [ ] All nodes still have unique IDs -- [ ] All nodes still have unique names -- [ ] Workflow settings are preserved - -## Node Modifications - -- [ ] Added nodes have unique IDs -- [ ] Added nodes have unique names -- [ ] Added nodes have valid node types -- [ ] Added nodes have required parameters set -- [ ] Modified nodes preserve their IDs -- [ ] Modified nodes have valid parameter values -- [ ] Removed nodes are completely removed from nodes array - -## Connections - -- [ ] All connections reference existing nodes -- [ ] Connections to/from added nodes are properly configured -- [ ] Connections affected by removed nodes are updated -- [ ] No orphaned connections remain -- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes) -- [ ] No circular dependencies (unless intentional) - -## Node Positioning - -- [ ] New nodes have valid positions -- [ ] New nodes don't overlap with existing nodes -- [ ] Node positions follow spacing guidelines (220px horizontal) -- [ ] Branch nodes have appropriate vertical spacing (±100px) - -## Error Handling - -- [ ] Error handling modifications are applied correctly -- [ ] Retry logic is properly configured if added -- [ ] continueOnFail settings are appropriate -- [ ] maxTries and waitBetweenTries are set if retries enabled - -## Data Flow - -- [ ] Data flow is maintained after modifications -- [ ] New transformations are properly configured -- [ ] Expressions use correct n8n syntax (={{ }}) -- [ ] No data flow breaks introduced - -## Integration Changes - -- [ ] New integrations are properly configured -- [ ] Credential requirements are identified -- [ ] API configurations are correct -- [ ] Existing integrations still work - -## Validation - -- [ ] Modified workflow passes JSON validation -- [ ] All modifications match user requirements -- [ ] No unintended changes were made -- [ ] Workflow structure is still logical - -## Backup & Recovery - -- [ ] Backup file was created successfully -- [ ] Backup location was communicated to user -- [ ] Original workflow can be restored if needed - -## Testing Readiness - -- [ ] Modified workflow can be imported into n8n -- [ ] Changes are testable -- [ ] Expected behavior is clear -- [ ] Any new credentials needed are identified - -## Documentation - -- [ ] Changes made are summarized for user -- [ ] User understands what was modified -- [ ] Testing recommendations provided if needed -- [ ] Backup location shared with user diff --git a/src/modules/bmm/workflows/autominator/modify-workflow/instructions.md b/src/modules/bmm/workflows/autominator/modify-workflow/instructions.md deleted file mode 100644 index 5f086d95..00000000 --- a/src/modules/bmm/workflows/autominator/modify-workflow/instructions.md +++ /dev/null @@ -1,327 +0,0 @@ -# Modify n8n Workflow - Workflow Instructions - -```xml -The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml -You MUST have already loaded and processed: {installed_path}/workflow.yaml -This workflow modifies an existing n8n workflow based on user requirements. - - - - - Before asking any questions, analyze what the user has already told you - - Review the user's initial request and conversation history - Extract any mentioned: workflow file path, changes needed, specific nodes - - - Summarize your understanding - Skip directly to Step 2 (Load Existing Workflow) - - - - Note what you already know - Only ask about missing information in Step 1 - - - - Proceed with full elicitation in Step 1 - - - - - Ask Question 1: "Which workflow file do you want to modify?" - Present numbered options: - 1. Provide file path - Specify exact path to workflow JSON - 2. Search in workflows folder - List available workflows - 3. Paste workflow JSON - Provide workflow content directly - - WAIT for user selection (1-3) - - - Ask: "Please provide the file path to the workflow JSON" - WAIT for user input - Store in {{workflow_file}} - - - - List all .json files in workflows/ directory - Present as numbered list - WAIT for user selection - Store selected file path in {{workflow_file}} - - - - Ask: "Please paste the workflow JSON content" - WAIT for user input - Create temporary file with content - Store temp file path in {{workflow_file}} - - - Ask Question 2: "What type of modification do you need?" - Present numbered options: - 1. Add new nodes - Add functionality to existing workflow - 2. Modify existing nodes - Change node parameters or configuration - 3. Remove nodes - Delete nodes from workflow - 4. Change connections - Modify how nodes are connected - 5. Update error handling - Add or modify retry/error logic - 6. Optimize workflow - Improve performance or structure - 7. Multiple changes - Combination of above - - WAIT for user selection (1-7) - Store selection in {{modification_type}} - - Ask Question 3: "Please describe the changes you want to make" - WAIT for user input - Store in {{changes_description}} - - - Ask: "What nodes do you want to add? (describe functionality)" - WAIT for user input - Store in {{nodes_to_add}} - - - - Ask: "Which nodes do you want to modify? (provide node names or descriptions)" - WAIT for user input - Store in {{nodes_to_modify}} - - - - Ask: "Which nodes do you want to remove? (provide node names)" - WAIT for user input - Store in {{nodes_to_remove}} - - - - - Only load the workflow file when user provides it - never preload - - Read workflow file from {{workflow_file}} - Parse JSON content - Validate JSON structure - - - Inform user: "The workflow file has invalid JSON syntax" - Show error details - Ask: "Would you like me to fix the JSON syntax first? (yes/no)" - WAIT for user response - - - Fix JSON syntax errors - Save corrected file - Proceed with loading - - - - Exit workflow with error - - - - Extract workflow structure: - - Workflow name - - List of nodes (names, types, IDs) - - Connections map - - Current settings - - Display workflow summary to user: - - Name: [workflow name] - - Nodes: [count] nodes - - Node list: [node names and types] - - Connections: [connection count] - - - - Create backup of original workflow - Save backup to: {{workflow_file}}.backup-{timestamp} - Store true in {{backup_created}} - Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" - - - - Check if Context7 MCP server is configured - Try to list available MCP tools - - - Store true in {{context7_available}} - Proceed to Step 5 - - - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Proceeding with built-in knowledge." - Proceed to Step 6 - - - - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Modification type: {{modification_type}} - - Nodes to add: {{nodes_to_add}} - - Changes description: {{changes_description}} - Store relevant documentation snippets for reference - - - - - Load {{helpers}} for node creation guidelines - Analyze current workflow structure - Plan modifications based on requirements: - - - 1. Identify where new nodes should be inserted - 2. Determine node types needed - 3. Plan connections to/from new nodes - 4. Calculate positions for new nodes - - - - 1. Identify nodes to modify by name or ID - 2. Determine what parameters to change - 3. Validate new parameter values - - - - 1. Identify nodes to remove by name or ID - 2. Identify connections that will be affected - 3. Plan how to reconnect remaining nodes - - - - 1. Identify connections to modify - 2. Validate new connection targets exist - 3. Update connection indices if needed - - - Present modification plan to user: - - Changes to be made: [detailed list] - - Nodes affected: [list] - - New connections: [list] - - Removed connections: [list] - - Ask: "Does this modification plan look correct?" - Present numbered options: - 1. Yes - Proceed with modifications - 2. No - Adjust the plan - 3. Add more changes - Include additional modifications - - WAIT for user selection (1-3) - - - Ask: "What changes or additions are needed?" - WAIT for user input - Adjust plan based on feedback - Repeat this step - - - - - Follow guidelines from {{helpers}} for proper node creation - - Load current workflow JSON into memory - - If Adding Nodes: - 1. Generate unique node IDs (check against existing IDs) - 2. Create node objects with proper structure - 3. Calculate positions (avoid overlaps with existing nodes) - 4. Add nodes to workflow.nodes array - 5. Create connections to/from new nodes - 6. Update connections object - - - If Modifying Nodes: - 1. Find nodes by name or ID - 2. Update parameters as specified - 3. Preserve node ID and other unchanged properties - 4. Validate new parameter values - 5. Update node in workflow.nodes array - - - If Removing Nodes: - 1. Find nodes by name or ID - 2. Remove from workflow.nodes array - 3. Remove all connections to/from removed nodes - 4. Update connections object - 5. Reconnect remaining nodes if needed - - - If Changing Connections: - 1. Update connections object - 2. Validate all referenced nodes exist - 3. Ensure connection indices are correct - 4. Remove orphaned connections - - - If Updating Error Handling: - 1. Find affected nodes - 2. Add or update error handling properties: - - continueOnFail - - retryOnFail - - maxTries - - waitBetweenTries - 3. Validate error handling configuration - - - Validate modified workflow: - - All node IDs are unique - - All node names are unique - - All connections reference existing nodes - - No orphaned nodes (except trigger) - - Node positions don't overlap - - - - Save modified workflow to {{workflow_file}} - Preserve original file location - - - - NEVER delete the file if validation fails - always fix syntax errors - - Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" - - - Read the error message carefully - it shows the syntax error and position - Open the file and navigate to the error location - Fix the syntax error (add missing comma, bracket, or quote as indicated) - Save the file - Re-run validation with the same command - Repeat until validation passes - - - Once validation passes, confirm with user: "Workflow modified successfully at {{workflow_file}}" - - - - Provide summary of changes made: - - Nodes added: [count and names] - - Nodes modified: [count and names] - - Nodes removed: [count and names] - - Connections changed: [count] - - Backup location: {{workflow_file}}.backup-{timestamp} - - Ask: "Would you like to make additional changes?" - Present numbered options: - 1. No - I'm done - 2. Yes - Make more modifications - 3. Revert - Restore from backup - - WAIT for user selection (1-3) - - - Return to Step 1 with current workflow - - - - Restore workflow from backup - Confirm restoration to user - - - - - Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml - - - -``` diff --git a/src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml deleted file mode 100644 index d829b7db..00000000 --- a/src/modules/bmm/workflows/autominator/modify-workflow/workflow.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: modify-workflow -description: "Edit or update existing n8n workflow" -author: "Saif" - -# Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/modify-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" -instructions: "{installed_path}/instructions.md" -validation: "{installed_path}/checklist.md" - -# Shared resources -helpers: "{shared_path}/n8n-helpers.md" -templates: "{shared_path}/n8n-templates.yaml" -platform_mappings: "{shared_path}/platform-mappings.yaml" - -# Variables -variables: - workflow_file: "" # Will be elicited - modification_type: "" # Will be elicited - changes_description: "" # Will be elicited - nodes_to_add: [] # Will be elicited - nodes_to_modify: [] # Will be elicited - nodes_to_remove: [] # Will be elicited - backup_created: false # Will be set - context7_available: false # Will be checked - -default_output_file: "" # Will use existing file location - -standalone: true -web_bundle: false diff --git a/src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md b/src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md deleted file mode 100644 index a5bbd1f2..00000000 --- a/src/modules/bmm/workflows/autominator/optimize-workflow/checklist.md +++ /dev/null @@ -1,130 +0,0 @@ -# Optimize n8n Workflow - Validation Checklist - -## Pre-Optimization - -- [ ] Original workflow was successfully loaded -- [ ] Workflow JSON was valid before optimization -- [ ] Optimization focus areas were identified -- [ ] Backup was created before making changes -- [ ] User requirements were clearly understood - -## Analysis Completeness - -- [ ] Performance analysis was conducted -- [ ] Error handling was reviewed -- [ ] Code quality was assessed -- [ ] Structure was evaluated -- [ ] Best practices were checked -- [ ] Security was reviewed -- [ ] All issues were documented - -## Recommendations Quality - -- [ ] Recommendations are specific and actionable -- [ ] Recommendations are prioritized correctly -- [ ] Impact of each recommendation is clear -- [ ] Implementation steps are provided -- [ ] Expected improvements are quantified -- [ ] No breaking changes are recommended - -## Performance Optimizations - -- [ ] Unnecessary nodes were identified/removed -- [ ] Data transformations were optimized -- [ ] Batch processing opportunities were identified -- [ ] Redundant API calls were consolidated -- [ ] Parallel execution opportunities were identified -- [ ] Node execution order was optimized - -## Error Handling Improvements - -- [ ] Critical nodes have retry logic -- [ ] continueOnFail is set appropriately -- [ ] Error workflows are configured where needed -- [ ] Timeout configurations are appropriate -- [ ] Error notifications are set up -- [ ] Error handling doesn't mask real issues - -## Code Quality Improvements - -- [ ] Set nodes are properly configured -- [ ] Code nodes are optimized -- [ ] Expressions use correct syntax -- [ ] Data types are handled correctly -- [ ] Hardcoded values are replaced with variables -- [ ] Node names are descriptive and consistent - -## Structure Improvements - -- [ ] Node positions are logical and organized -- [ ] Complex branches are simplified where possible -- [ ] Duplicate logic is eliminated -- [ ] Merge points are optimized -- [ ] Connection patterns are clean -- [ ] Workflow flow is easy to follow - -## Best Practices Applied - -- [ ] Credentials are used correctly -- [ ] Security issues are addressed -- [ ] Node types are appropriate -- [ ] Node versions are up to date -- [ ] Data handling follows best practices -- [ ] Workflow settings are optimal - -## Security Improvements - -- [ ] No credentials are exposed -- [ ] Sensitive data is handled properly -- [ ] No hardcoded secrets remain -- [ ] Authentication is properly configured -- [ ] Data is sanitized where needed -- [ ] Security best practices are followed - -## Workflow Integrity - -- [ ] All node IDs remain unique -- [ ] All node names remain unique -- [ ] All connections are valid -- [ ] No functionality is lost -- [ ] Workflow still achieves original purpose -- [ ] No breaking changes introduced - -## Validation - -- [ ] Optimized workflow passes JSON validation -- [ ] All optimizations were applied correctly -- [ ] No unintended changes were made -- [ ] Workflow structure is still logical -- [ ] All improvements are documented - -## Backup & Recovery - -- [ ] Backup file was created successfully -- [ ] Backup location was communicated to user -- [ ] Original workflow can be restored if needed - -## Testing Readiness - -- [ ] Optimized workflow can be imported into n8n -- [ ] Test scenarios are identified -- [ ] Expected improvements are measurable -- [ ] Comparison approach is defined -- [ ] Monitoring plan is suggested - -## Documentation - -- [ ] Analysis report is comprehensive -- [ ] All findings are documented -- [ ] Recommendations are clearly explained -- [ ] Expected improvements are quantified -- [ ] Testing recommendations are provided -- [ ] User understands all changes made - -## Expected Improvements - -- [ ] Performance improvements are quantified -- [ ] Reliability improvements are identified -- [ ] Maintainability improvements are clear -- [ ] Security improvements are documented -- [ ] Cost savings are estimated (if applicable) diff --git a/src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md b/src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md deleted file mode 100644 index b8823d11..00000000 --- a/src/modules/bmm/workflows/autominator/optimize-workflow/instructions.md +++ /dev/null @@ -1,446 +0,0 @@ -# Optimize n8n Workflow - Workflow Instructions - -```xml -The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml -You MUST have already loaded and processed: {installed_path}/workflow.yaml -This workflow analyzes and optimizes existing n8n workflows for performance and best practices. - - - - - Before asking any questions, analyze what the user has already told you - - Review the user's initial request and conversation history - Extract any mentioned: workflow file path, performance issues, optimization goals - - - Summarize your understanding - Skip directly to Step 2 (Load Workflow) - - - - Note what you already know - Only ask about missing information in Step 1 - - - - Proceed with full elicitation in Step 1 - - - - - Ask Question 1: "Which workflow do you want to optimize?" - Present numbered options: - 1. Provide file path - Specify exact path to workflow JSON - 2. Search in workflows folder - List available workflows - 3. Paste workflow JSON - Provide workflow content directly - - WAIT for user selection (1-3) - - - Ask: "Please provide the file path to the workflow JSON" - WAIT for user input - Store in {{workflow_file}} - - - - List all .json files in workflows/ directory - Present as numbered list - WAIT for user selection - Store selected file path in {{workflow_file}} - - - - Ask: "Please paste the workflow JSON content" - WAIT for user input - Create temporary file with content - Store temp file path in {{workflow_file}} - - - Ask Question 2: "What aspects do you want to optimize?" - Present numbered options (can select multiple): - 1. Performance - Improve execution speed and efficiency - 2. Error Handling - Add or improve error handling and retries - 3. Code Quality - Improve node configuration and data transformations - 4. Structure - Improve workflow organization and readability - 5. Best Practices - Apply n8n best practices and patterns - 6. Security - Improve credential handling and data security - 7. All - Comprehensive optimization review - - WAIT for user selection (1-7 or multiple) - Store selections in {{optimization_focus}} - - Ask Question 3: "Are there specific issues or pain points?" - Present numbered options: - 1. No - Just general optimization - 2. Yes - Describe specific issues - - WAIT for user selection (1-2) - - - Ask: "Please describe the issues (slow execution, errors, etc.)" - WAIT for user input - Store in {{specific_issues}} - - - - - Only load the workflow file when user provides it - never preload - - Read workflow file from {{workflow_file}} - Parse JSON content - Validate JSON structure - - - Inform user: "The workflow file has invalid JSON syntax" - Show error details - Ask: "Would you like me to fix the JSON syntax first? (yes/no)" - WAIT for user response - - - Fix JSON syntax errors - Save corrected file - Proceed with loading - - - - Exit workflow with error - - - - Extract workflow structure: - - Workflow name and settings - - Node count and types - - Connection patterns - - Error handling configuration - - Credential usage - - Display workflow summary to user: - - Name: [workflow name] - - Nodes: [count] nodes - - Complexity: [simple/medium/complex] - - Integrations: [list of services] - - - - Check if Context7 MCP server is configured - Try to list available MCP tools - - - Store true in {{context7_available}} - Proceed to Step 4 - - - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Using built-in n8n best practices." - Proceed to Step 5 - - - - - - Resolve n8n library ID using Context7 - Query Context7 for n8n best practices documentation - Query for optimization techniques - Query for performance tips - Store relevant documentation for reference - - - - - Load {{helpers}} for best practices reference - - Perform comprehensive analysis based on {{optimization_focus}}: - - Performance Analysis: - - Check for unnecessary nodes - - Identify inefficient data transformations - - Look for missing batch processing opportunities - - Check for redundant API calls - - Analyze node execution order - - Identify parallel execution opportunities - - - Error Handling Analysis: - - Check if critical nodes have retry logic - - Verify continueOnFail settings - - Look for missing error workflows - - Check timeout configurations - - Verify error notification setup - - - Code Quality Analysis: - - Review Set node configurations - - Review Code node implementations - - Check expression syntax and efficiency - - Verify data type handling - - Check for hardcoded values - - Review node naming conventions - - - Structure Analysis: - - Check node positioning and layout - - Verify logical flow organization - - Look for overly complex branches - - Check for duplicate logic - - Verify proper use of merge nodes - - Check connection patterns - - - Best Practices Analysis: - - Verify proper credential usage - - Check for security issues - - Verify proper use of node types - - Check for deprecated node versions - - Verify proper data handling - - Check workflow settings - - - Security Analysis: - - Check credential exposure - - Verify sensitive data handling - - Check for hardcoded secrets - - Verify proper authentication - - Check data sanitization - - - Store all findings in {{issues_found}} - - - - For each issue found, generate specific recommendations: - - Categorize recommendations by priority: - - Critical: Security issues, major performance problems - - High: Error handling gaps, significant inefficiencies - - Medium: Code quality improvements, minor optimizations - - Low: Cosmetic improvements, nice-to-haves - - For each recommendation, provide: - 1. Issue description - 2. Impact explanation - 3. Specific solution - 4. Implementation steps - 5. Expected improvement - - Store recommendations in {{recommendations}} - - - - Present comprehensive optimization report: - - ## Workflow Analysis Report - Workflow: {{workflow_name}} - Analysis Date: {timestamp} - Optimization Focus: {{optimization_focus}} - - ### Summary - - Total Issues Found: [count] - - Critical: [count] - - High Priority: [count] - - Medium Priority: [count] - - Low Priority: [count] - - ### Detailed Findings - Present each issue with: - - Priority level - - Issue description - - Current state - - Recommended solution - - Expected impact - - ### Performance Opportunities - List specific performance improvements with estimated impact - - ### Best Practice Violations - List n8n best practices not being followed - - Ask: "Would you like me to apply these optimizations?" - Present numbered options: - 1. Yes - Apply all recommendations - 2. Yes - Apply only critical and high priority - 3. Yes - Let me choose which to apply - 4. No - Just provide the report - 5. Explain more - I need more details first - - WAIT for user selection (1-5) - - - Ask: "Which recommendations would you like explained?" - WAIT for user input - Provide detailed explanation - Repeat this step - - - - Present recommendations as numbered list - Ask: "Select recommendations to apply (comma-separated numbers)" - WAIT for user input - Store selected recommendations - - - - Store true in {{apply_changes}} - Proceed to Step 8 - - - - Store false in {{apply_changes}} - Skip to Step 11 (provide report only) - - - - - - Create backup of original workflow - Save backup to: {{workflow_file}}.backup-{timestamp} - Store true in {{backup_created}} - Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" - - - - - Follow guidelines from {{helpers}} for proper node configuration - - Load current workflow JSON into memory - - Apply each selected recommendation: - - Performance Optimizations: - - Remove unnecessary nodes - - Optimize data transformations - - Add batch processing where applicable - - Consolidate redundant API calls - - Optimize node execution order - - Add parallel execution where possible - - - Error Handling Improvements: - - Add retry logic to critical nodes - - Set appropriate continueOnFail values - - Add error workflows if needed - - Configure timeouts - - Add error notifications - - - Code Quality Improvements: - - Refactor Set node configurations - - Optimize Code node implementations - - Improve expression syntax - - Fix data type handling - - Replace hardcoded values with variables - - Improve node naming - - - Structure Improvements: - - Reorganize node positions - - Simplify complex branches - - Remove duplicate logic - - Optimize merge points - - Improve connection patterns - - - Best Practice Applications: - - Fix credential usage - - Address security issues - - Update deprecated nodes - - Improve data handling - - Update workflow settings - - - Validate optimized workflow: - - All node IDs remain unique - - All connections are valid - - No functionality is lost - - All improvements are applied - - - - Save optimized workflow to {{workflow_file}} - - - - - NEVER delete the file if validation fails - always fix syntax errors - - Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')" - - - Read the error message carefully - it shows the syntax error and position - Open the file and navigate to the error location - Fix the syntax error (add missing comma, bracket, or quote as indicated) - Save the file - Re-run validation with the same command - Repeat until validation passes - - - Once validation passes, confirm with user: "Workflow optimized successfully at {{workflow_file}}" - - - - - Provide comprehensive summary: - - - ### Optimizations Applied - - Total changes: [count] - - Performance improvements: [list] - - Error handling added: [list] - - Code quality fixes: [list] - - Structure improvements: [list] - - Best practices applied: [list] - - Backup location: {{workflow_file}}.backup-{timestamp} - - ### Expected Improvements - - Execution speed: [estimated improvement] - - Reliability: [improvements] - - Maintainability: [improvements] - - Security: [improvements] - - ### Testing Recommendations - 1. Import optimized workflow into n8n - 2. Test with sample data - 3. Compare execution times with original - 4. Verify all functionality works correctly - 5. Monitor error rates - - - - ### Optimization Report - Report saved with all recommendations - No changes applied to workflow - Review recommendations and apply manually if desired - - - Ask: "Would you like additional help?" - Present numbered options: - 1. No - I'm done - 2. Yes - Explain specific optimizations - 3. Yes - Optimize another workflow - 4. Revert - Restore from backup - - WAIT for user selection (1-4) - - - Ask: "Which optimization would you like explained?" - WAIT for user input - Provide detailed explanation - - - - Return to Step 1 for new workflow - - - - Restore workflow from backup - Confirm restoration to user - - - - - Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml - - - -``` diff --git a/src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml b/src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml deleted file mode 100644 index b3310a10..00000000 --- a/src/modules/bmm/workflows/autominator/optimize-workflow/workflow.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: optimize-workflow -description: "Review and improve existing n8n workflows for performance and best practices" -author: "Saif" - -# Workflow components -installed_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/optimize-workflow" -shared_path: "{project-root}/{bmad_folder}/bmm/workflows/autominator/_shared" -instructions: "{installed_path}/instructions.md" -validation: "{installed_path}/checklist.md" - -# Shared resources -helpers: "{shared_path}/n8n-helpers.md" -templates: "{shared_path}/n8n-templates.yaml" -platform_mappings: "{shared_path}/platform-mappings.yaml" - -# Variables -variables: - workflow_file: "" # Will be elicited - optimization_focus: [] # Will be elicited - issues_found: [] # Will be identified - recommendations: [] # Will be generated - apply_changes: false # Will be elicited - backup_created: false # Will be set - context7_available: false # Will be checked - -default_output_file: "" # Will use existing file location - -standalone: true -web_bundle: false From 3fa08655429416d627d4f68372650abdedec224c Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Thu, 20 Nov 2025 14:53:43 +0500 Subject: [PATCH 10/16] refactor(autominator): simplify Context7 MCP recommendation --- .../workflows/create-workflow/instructions.md | 38 ++----------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/src/modules/autominator/workflows/create-workflow/instructions.md b/src/modules/autominator/workflows/create-workflow/instructions.md index 161ddb27..3284a80d 100644 --- a/src/modules/autominator/workflows/create-workflow/instructions.md +++ b/src/modules/autominator/workflows/create-workflow/instructions.md @@ -130,41 +130,9 @@ Store false in {{context7_available}} Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation." - Ask: "Would you like help setting up Context7 MCP? (yes/no)" - WAIT for user response - - - Guide user through Context7 MCP setup: - 1. Inform user: "Context7 MCP requires the 'uvx' command (part of uv Python package manager)" - 2. Ask: "Do you have 'uv' installed? (yes/no/not sure)" - WAIT for response - - - Provide installation guidance: - - macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh - - Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" - - Or via pip: pip install uv - Ask user to install and confirm when ready - WAIT for confirmation - - - 3. Inform user: "Please configure Context7 MCP in your IDE's MCP settings with:" - - Server name: context7 - Command: uvx - Args: ["context7"] - Auto-approve tools: ["resolve-library-id", "get-library-docs"] - - 4. Ask user to reconnect/restart MCP servers in their IDE - 5. Wait for user confirmation that MCP is reconnected - 6. Verify Context7 is now available - Store result in {{context7_available}} - - - - Inform: "Proceeding without Context7. Using built-in n8n knowledge." - Proceed to Step 4 - + Recommend: "For best results, install Context7 MCP server in your IDE. See: https://github.com/context7/context7" + Inform: "Proceeding with built-in n8n knowledge." + Proceed to Step 4 From ffe6f6c26bf287b57162e5d6ad475c76ccdbb8c8 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Thu, 20 Nov 2025 15:10:35 +0500 Subject: [PATCH 11/16] feat(autominator): improve elicitation to focus on actual problems --- .../workflows/create-workflow/instructions.md | 203 +++++++++++------- .../migrate-workflow/instructions.md | 76 +++---- .../workflows/modify-workflow/instructions.md | 62 +++--- .../optimize-workflow/instructions.md | 52 +++-- 4 files changed, 237 insertions(+), 156 deletions(-) diff --git a/src/modules/autominator/workflows/create-workflow/instructions.md b/src/modules/autominator/workflows/create-workflow/instructions.md index 3284a80d..3e648889 100644 --- a/src/modules/autominator/workflows/create-workflow/instructions.md +++ b/src/modules/autominator/workflows/create-workflow/instructions.md @@ -29,92 +29,107 @@ - Ask Question 1: "What type of automation workflow do you need?" + Start by understanding the ACTUAL PROBLEM the user wants to solve, not just technical requirements + + Ask Question 1: "What problem are you trying to solve with this automation?" + Encourage detailed explanation: "Describe the current manual process, pain points, and desired outcome." + WAIT for user input + Store in {{problem_description}} + + Ask Question 2: "What triggers this process? When should the automation run?" Present numbered options: - 1. Webhook-based - Receive HTTP requests and process data - 2. Scheduled - Run on a schedule (cron/interval) - 3. Event-driven - Trigger from external service events - 4. Manual - Execute on demand - 5. Database-driven - Trigger from database changes - 6. Other - Describe your specific trigger needs + 1. When data arrives - Webhook, form submission, API call + 2. On a schedule - Every hour, daily, weekly, custom cron + 3. When something changes - Database update, file change, service event + 4. Manually - On-demand execution + 5. Multiple triggers - Combination of above + 6. Not sure - Help me decide based on my problem WAIT for user selection (1-6) - Store selection in {{workflow_type}} + Store selection in {{trigger_type}} - - Ask: "Please describe your trigger requirements" - WAIT for user input - Store in {{workflow_type}} + + Analyze {{problem_description}} and suggest appropriate trigger + Ask: "Based on your problem, I recommend [trigger type]. Does this make sense?" + WAIT for confirmation or adjustment + Store final trigger in {{trigger_type}} - Ask Question 2: "What integrations or services will this workflow use?" - Present numbered options: - 1. HTTP/REST APIs - Generic API calls - 2. Databases - PostgreSQL, MySQL, MongoDB, etc. - 3. Cloud Services - Google Sheets, Slack, Notion, Airtable - 4. Email - Send/receive emails - 5. CRM - HubSpot, Salesforce, etc. - 6. Custom Code - JavaScript/Python logic - 7. Multiple - Combination of above - 8. Other - Specify integrations - - WAIT for user selection (1-8) - Store selection in {{integrations}} + Ask Question 3: "What data or information does this workflow need to work with?" + Examples: "Customer data, order details, form responses, API data, etc." + WAIT for user input + Store in {{data_requirements}} - - Ask: "Please list all integrations needed (comma-separated)" + Ask Question 4: "What should happen with this data? What's the desired outcome?" + Examples: "Send to Slack, update database, create invoice, notify team, etc." + WAIT for user input + Store in {{desired_outcome}} + + Ask Question 5: "What services or systems are involved?" + Examples: "Slack, Google Sheets, PostgreSQL, HubSpot, custom API, etc." + WAIT for user input + Store in {{integrations}} + + Ask Question 6: "Are there any conditions or decision points in this process?" + Examples: "If amount > $1000, notify manager; If status = 'urgent', send immediately" + Present numbered options: + 1. No - Straight-through processing + 2. Yes - Describe the conditions + + WAIT for user selection (1-2) + + Ask: "Describe the conditions and what should happen in each case" WAIT for user input - Store in {{integrations}} + Store in {{conditional_logic}} - Ask Question 3: "How complex is your workflow logic?" + Ask Question 7: "How critical is this workflow? What happens if it fails?" Present numbered options: - 1. Simple (3-5 nodes) - Linear flow with minimal logic - 2. Medium (6-10 nodes) - Some conditional logic or branching - 3. Complex (11-20 nodes) - Multiple branches, loops, or error handling - 4. Very Complex (20+ nodes) - Advanced logic with parallel processing + 1. Low - Can retry manually if needed + 2. Medium - Should retry automatically, notify on failure + 3. High - Must succeed, need alerts and logging + 4. Critical - Business-critical, need comprehensive error handling WAIT for user selection (1-4) - Store selection in {{complexity}} + Store selection in {{criticality}} - Ask Question 4: "Do you need error handling and retry logic?" - Present numbered options: - 1. No - Simple workflow without error handling - 2. Basic - Retry failed operations automatically - 3. Advanced - Custom error handling with notifications - 4. Comprehensive - Full error workflow with logging and alerts - - WAIT for user selection (1-4) - Store selection in {{error_handling}} - - Ask Question 5: "What should the workflow be named?" + Ask Question 8: "What should the workflow be named?" + Suggest name based on {{problem_description}} WAIT for user input Store in {{workflow_name}} - Ask Question 6: "Where should the workflow file be saved?" + Ask Question 9: "Where should the workflow file be saved?" Present numbered options: 1. Default location - workflows/[workflow-name].json 2. Custom path - Specify your own file path - 3. Project root - Save in main project directory - 4. Specific folder - Choose from existing folders - WAIT for user selection (1-4) - + WAIT for user selection (1-2) + Ask for specific path WAIT for user input Store final path in {{save_location}} - Ask Question 7: "Any additional requirements or specific logic needed?" + Summarize understanding: + - Problem: {{problem_description}} + - Trigger: {{trigger_type}} + - Data: {{data_requirements}} + - Outcome: {{desired_outcome}} + - Services: {{integrations}} + - Conditions: {{conditional_logic}} + - Criticality: {{criticality}} + + Ask: "Does this capture your requirements correctly?" Present numbered options: - 1. No - Proceed with current requirements - 2. Yes - Describe additional requirements + 1. Yes - Proceed with workflow creation + 2. No - Let me clarify or add details WAIT for user selection (1-2) - Ask: "Please describe additional requirements" + Ask: "What needs to be clarified or added?" WAIT for user input - Store in {{additional_requirements}} + Update relevant variables + Repeat summary and confirmation @@ -153,32 +168,70 @@ - Based on gathered requirements, plan the workflow structure: - 1. Identify trigger node type - 2. List all action nodes needed - 3. Identify conditional logic (IF nodes) - 4. Plan data transformations (Set/Code nodes) - 5. Design error handling strategy - 6. Map node connections + Design workflow based on the ACTUAL PROBLEM, not just technical specs - Present the planned structure to user in clear format: - - Trigger: [trigger type] - - Nodes: [list of nodes with descriptions] - - Logic: [conditional branches, loops] - - Error Handling: [strategy] + Analyze the problem and requirements: + - Problem to solve: {{problem_description}} + - Trigger: {{trigger_type}} + - Data needed: {{data_requirements}} + - Desired outcome: {{desired_outcome}} + - Services: {{integrations}} + - Conditions: {{conditional_logic}} + - Criticality: {{criticality}} - Ask: "Does this structure meet your needs?" + Design workflow structure that solves the problem: + 1. Map trigger to appropriate n8n trigger node + 2. Design data acquisition steps (API calls, database queries) + 3. Plan data transformations needed for the outcome + 4. Implement conditional logic from {{conditional_logic}} + 5. Design actions to achieve {{desired_outcome}} + 6. Add error handling based on {{criticality}} + 7. Plan node connections and data flow + + Present the solution-focused workflow plan: + ## Workflow Solution for: {{problem_description}} + + **How it works:** + [Explain in plain language how the workflow solves the problem] + + **Workflow Steps:** + 1. Trigger: [When/how it starts] - [n8n node type] + 2. Get Data: [What data is retrieved] - [n8n nodes] + 3. Process: [How data is transformed] - [n8n nodes] + 4. Decide: [Conditional logic if any] - [IF/Switch nodes] + 5. Act: [Final actions to achieve outcome] - [n8n nodes] + 6. Handle Errors: [Error strategy] - [Error handling config] + + **Expected Result:** + [Describe what happens when workflow runs successfully] + + Ask: "Does this workflow solve your problem?" Present numbered options: - 1. Yes - Proceed with this structure - 2. No - Adjust the structure - 3. Add more details - Provide additional requirements + 1. Yes - This solves my problem, proceed + 2. No - Missing something important + 3. Partially - Needs adjustments + 4. Explain more - I need clarification - WAIT for user selection (1-3) + WAIT for user selection (1-4) - - Ask: "What changes or additions are needed?" + + Ask: "What's missing? What else needs to happen?" WAIT for user input - Adjust structure based on feedback + Adjust workflow design to include missing elements + Repeat this step + + + + Ask: "What needs to be adjusted?" + WAIT for user input + Modify workflow design based on feedback + Repeat this step + + + + Ask: "Which part needs clarification?" + WAIT for user input + Provide detailed explanation of that part Repeat this step diff --git a/src/modules/autominator/workflows/migrate-workflow/instructions.md b/src/modules/autominator/workflows/migrate-workflow/instructions.md index 17ffd53d..b427c510 100644 --- a/src/modules/autominator/workflows/migrate-workflow/instructions.md +++ b/src/modules/autominator/workflows/migrate-workflow/instructions.md @@ -29,7 +29,14 @@ - Ask Question 1: "Which platform are you migrating from?" + Understand the BUSINESS PURPOSE of the workflow being migrated, not just technical details + + Ask Question 1: "What does this workflow do? What problem does it solve?" + Encourage business context: "Describe the business process, not just the technical steps" + WAIT for user input + Store in {{business_purpose}} + + Ask Question 2: "Which platform are you migrating from?" Present numbered options: 1. Zapier - Migrate Zapier Zaps to n8n 2. Make (Integromat) - Migrate Make scenarios to n8n @@ -47,66 +54,59 @@ Store in {{source_platform}} - Ask Question 2: "How will you provide the workflow to migrate?" + Ask Question 3: "Why are you migrating to n8n?" + Examples: "Cost savings", "More flexibility", "Self-hosting", "Better integrations" + WAIT for user input + Store in {{migration_reason}} + + Ask Question 4: "How will you provide the workflow details?" Present numbered options: - 1. Describe it - Explain what the workflow does + 1. Describe the process - Explain what happens step by step 2. Provide export file - Upload/paste workflow export file 3. Provide screenshots - Share workflow screenshots - 4. Provide documentation - Share workflow documentation + 4. Combination - Multiple sources WAIT for user selection (1-4) - - Ask: "Please describe what the workflow does (trigger, actions, logic)" + + Ask: "Describe the workflow step by step:" + - What triggers it? + - What data does it process? + - What actions does it take? + - What's the final outcome? WAIT for user input Store in {{workflow_description}} - + Ask: "Please provide the workflow export file path or paste the content" WAIT for user input Store in {{workflow_file}} or {{workflow_content}} - - Ask: "Please share the workflow screenshots and describe the flow" + + Ask: "Please share the workflow screenshots and describe what each part does" WAIT for user input - Store in {{workflow_description}} + Store in {{workflow_screenshots}} - - Ask: "Please provide the workflow documentation" - WAIT for user input - Store in {{workflow_description}} - - - Ask Question 3: "What is the trigger for this workflow?" - Present numbered options: - 1. Webhook/HTTP Request - Triggered by incoming HTTP requests - 2. Schedule/Cron - Runs on a schedule - 3. Form Submission - Triggered by form submissions - 4. Database Change - Triggered by database events - 5. Email - Triggered by incoming emails - 6. Service Event - Triggered by external service (Slack, Google Sheets, etc.) - 7. Not sure - Will determine from workflow details - - WAIT for user selection (1-7) - Store selection in {{trigger_type}} - - Ask Question 4: "What integrations/services does this workflow use?" - Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)" + Ask Question 5: "What services/integrations does this workflow connect to?" + Ask: "List all services (e.g., Slack, Google Sheets, HubSpot, custom APIs, etc.)" WAIT for user input Store in {{integrations_used}} - Ask Question 5: "How complex is the workflow?" + Ask Question 6: "Are there any pain points or issues with the current workflow?" + Examples: "Slow execution", "Unreliable", "Missing features", "Hard to maintain" Present numbered options: - 1. Simple - Linear flow with 3-5 steps - 2. Medium - Some conditional logic, 6-10 steps - 3. Complex - Multiple branches, loops, 11-20 steps - 4. Very Complex - Advanced logic, 20+ steps + 1. No - Works fine, just migrating platform + 2. Yes - Describe the issues - WAIT for user selection (1-4) - Store selection in {{complexity}} + WAIT for user selection (1-2) + + Ask: "What issues should we fix during migration?" + WAIT for user input + Store in {{issues_to_fix}} + Ask Question 6: "What should the migrated workflow be named?" WAIT for user input diff --git a/src/modules/autominator/workflows/modify-workflow/instructions.md b/src/modules/autominator/workflows/modify-workflow/instructions.md index 5f086d95..9fcc2e8a 100644 --- a/src/modules/autominator/workflows/modify-workflow/instructions.md +++ b/src/modules/autominator/workflows/modify-workflow/instructions.md @@ -29,6 +29,8 @@ + Understand WHY the user wants to modify the workflow, not just WHAT to change + Ask Question 1: "Which workflow file do you want to modify?" Present numbered options: 1. Provide file path - Specify exact path to workflow JSON @@ -57,39 +59,43 @@ Store temp file path in {{workflow_file}} - Ask Question 2: "What type of modification do you need?" - Present numbered options: - 1. Add new nodes - Add functionality to existing workflow - 2. Modify existing nodes - Change node parameters or configuration - 3. Remove nodes - Delete nodes from workflow - 4. Change connections - Modify how nodes are connected - 5. Update error handling - Add or modify retry/error logic - 6. Optimize workflow - Improve performance or structure - 7. Multiple changes - Combination of above - - WAIT for user selection (1-7) - Store selection in {{modification_type}} - - Ask Question 3: "Please describe the changes you want to make" + Ask Question 2: "What problem are you trying to solve by modifying this workflow?" + Examples: "It's not handling errors properly", "Need to add Slack notifications", "Missing data validation" WAIT for user input - Store in {{changes_description}} + Store in {{problem_to_solve}} - - Ask: "What nodes do you want to add? (describe functionality)" - WAIT for user input - Store in {{nodes_to_add}} - + Ask Question 3: "What's currently not working or missing?" + Encourage specific details about the issue or gap + WAIT for user input + Store in {{current_issue}} - - Ask: "Which nodes do you want to modify? (provide node names or descriptions)" - WAIT for user input - Store in {{nodes_to_modify}} - + Ask Question 4: "What should the workflow do after these changes?" + Focus on the desired behavior and outcome + WAIT for user input + Store in {{desired_behavior}} - - Ask: "Which nodes do you want to remove? (provide node names)" + Ask Question 5: "Are there any specific nodes, integrations, or logic you want to change?" + Examples: "Add a Slack node after approval", "Change the IF condition to check status", "Remove the delay node" + WAIT for user input + Store in {{specific_changes}} + + Summarize understanding: + - Problem: {{problem_to_solve}} + - Current Issue: {{current_issue}} + - Desired Behavior: {{desired_behavior}} + - Specific Changes: {{specific_changes}} + + Ask: "Does this capture what you need?" + Present numbered options: + 1. Yes - Proceed with modifications + 2. No - Let me clarify + + WAIT for user selection (1-2) + + Ask: "What needs clarification?" WAIT for user input - Store in {{nodes_to_remove}} + Update relevant variables + Repeat summary and confirmation diff --git a/src/modules/autominator/workflows/optimize-workflow/instructions.md b/src/modules/autominator/workflows/optimize-workflow/instructions.md index b8823d11..caadb25a 100644 --- a/src/modules/autominator/workflows/optimize-workflow/instructions.md +++ b/src/modules/autominator/workflows/optimize-workflow/instructions.md @@ -29,6 +29,8 @@ + Understand the REAL PROBLEMS the user is experiencing, not just generic optimization goals + Ask Question 1: "Which workflow do you want to optimize?" Present numbered options: 1. Provide file path - Specify exact path to workflow JSON @@ -57,30 +59,50 @@ Store temp file path in {{workflow_file}} - Ask Question 2: "What aspects do you want to optimize?" + Ask Question 2: "What problems are you experiencing with this workflow?" + Examples: "Takes too long to run", "Fails frequently", "Hard to understand", "Doesn't handle errors well" + WAIT for user input + Store in {{problems_experienced}} + + Ask Question 3: "What's the business impact of these problems?" + Examples: "Delays customer responses", "Wastes team time", "Causes data issues", "Costs money" + WAIT for user input + Store in {{business_impact}} + + Ask Question 4: "What would 'better' look like for this workflow?" + Focus on desired outcomes: "Faster execution", "More reliable", "Easier to maintain", "Better error recovery" + WAIT for user input + Store in {{desired_improvements}} + + Ask Question 5: "Are there specific areas you want me to focus on?" Present numbered options (can select multiple): - 1. Performance - Improve execution speed and efficiency - 2. Error Handling - Add or improve error handling and retries - 3. Code Quality - Improve node configuration and data transformations - 4. Structure - Improve workflow organization and readability - 5. Best Practices - Apply n8n best practices and patterns - 6. Security - Improve credential handling and data security - 7. All - Comprehensive optimization review + 1. Performance - Speed and efficiency + 2. Reliability - Error handling and retries + 3. Maintainability - Code quality and structure + 4. Security - Credential and data handling + 5. All - Comprehensive review + 6. Let you decide - Analyze and recommend - WAIT for user selection (1-7 or multiple) + WAIT for user selection (1-6 or multiple) Store selections in {{optimization_focus}} - Ask Question 3: "Are there specific issues or pain points?" + Summarize understanding: + - Problems: {{problems_experienced}} + - Business Impact: {{business_impact}} + - Desired Improvements: {{desired_improvements}} + - Focus Areas: {{optimization_focus}} + + Ask: "Does this capture your optimization needs?" Present numbered options: - 1. No - Just general optimization - 2. Yes - Describe specific issues + 1. Yes - Proceed with analysis + 2. No - Let me clarify WAIT for user selection (1-2) - - Ask: "Please describe the issues (slow execution, errors, etc.)" + Ask: "What needs clarification?" WAIT for user input - Store in {{specific_issues}} + Update relevant variables + Repeat summary and confirmation From 6d1da5fc72750384015b9b4517ea1b01b98258de Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Fri, 21 Nov 2025 20:39:36 +0500 Subject: [PATCH 12/16] refactor(autominator): Replace Context7 MCP integration with web search Updated documentation, configuration, agent persona, and workflow instructions to remove Context7 MCP references and implement web search for accessing up-to-date n8n documentation. Variables and installer prompts related to Context7 were removed for consistency. --- src/modules/autominator/README.md | 21 +++----- .../_module-installer/install-config.yaml | 10 ---- .../autominator/agents/autominator.agent.yaml | 4 +- .../workflows/create-workflow/instructions.md | 54 +++++++++---------- .../workflows/create-workflow/workflow.yaml | 1 - .../migrate-workflow/instructions.md | 48 +++++++++-------- .../workflows/migrate-workflow/workflow.yaml | 1 - .../workflows/modify-workflow/instructions.md | 45 ++++++++-------- .../workflows/modify-workflow/workflow.yaml | 1 - .../optimize-workflow/instructions.md | 47 +++++++++------- .../workflows/optimize-workflow/workflow.yaml | 1 - 11 files changed, 112 insertions(+), 121 deletions(-) diff --git a/src/modules/autominator/README.md b/src/modules/autominator/README.md index d151ff71..7f009c17 100644 --- a/src/modules/autominator/README.md +++ b/src/modules/autominator/README.md @@ -14,7 +14,7 @@ Autominator is an independent BMAD module that specializes in n8n workflow autom - Expert in n8n workflow creation, modification, and optimization - Specializes in platform migration (Zapier, Make, HubSpot, Power Automate) -- Uses Context7 MCP for up-to-date n8n documentation +- Uses web search to access up-to-date n8n documentation - Smart elicitation for accurate requirement gathering - Comprehensive workflow validation and testing @@ -35,7 +35,7 @@ Build new n8n workflows from scratch based on your requirements. - Integration selection and configuration - Complexity assessment - Error handling strategy planning -- Context7 MCP integration for latest n8n docs +- Web search integration for latest n8n docs - Automatic JSON validation ### 2. Modify Workflow @@ -158,12 +158,12 @@ agent autominator/autominator ## Features -### Context7 MCP Integration +### Web Search Integration -- Automatic Context7 availability check -- Fallback to built-in knowledge if unavailable -- IDE-agnostic setup guidance -- Up-to-date n8n documentation access +- Automatic web search for n8n documentation +- Accesses official docs.n8n.io resources +- Up-to-date node configurations and best practices +- Problem-specific solution research ### Smart Elicitation @@ -230,7 +230,6 @@ autominator/ ## Requirements - n8n instance or account -- Context7 MCP server (optional, for latest docs) - IDE with BMAD support ## Installation @@ -266,12 +265,6 @@ Autominator is independent but can be used alongside: ## Troubleshooting -### Context7 MCP Not Available - -- Install uv: `curl -LsSf https://astral.sh/uv/install.sh | sh` -- Configure Context7 in your IDE's MCP settings -- Restart MCP servers - ### Workflow JSON Validation Fails - Check for missing commas or brackets diff --git a/src/modules/autominator/_module-installer/install-config.yaml b/src/modules/autominator/_module-installer/install-config.yaml index 1b301a5f..61f422cf 100644 --- a/src/modules/autominator/_module-installer/install-config.yaml +++ b/src/modules/autominator/_module-installer/install-config.yaml @@ -55,13 +55,3 @@ primary_integrations: label: "Email" - value: "custom" label: "Custom/Other" - -enable_context7: - prompt: "Enable Context7 MCP for up-to-date n8n documentation?" - default: true - result: "{value}" - single-select: - - value: true - label: "Yes - Use Context7 for latest docs" - - value: false - label: "No - Use built-in knowledge" diff --git a/src/modules/autominator/agents/autominator.agent.yaml b/src/modules/autominator/agents/autominator.agent.yaml index 3611c32c..6c8d3641 100644 --- a/src/modules/autominator/agents/autominator.agent.yaml +++ b/src/modules/autominator/agents/autominator.agent.yaml @@ -11,10 +11,10 @@ agent: persona: role: n8n Workflow Automation Specialist - identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7. + identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via web search. communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. Direct, confident, and results-focused. principles: | - - Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations. + - Web Search Integration - Always search for latest n8n documentation from docs.n8n.io for accurate, up-to-date implementations. - Elicitation First - Understand requirements thoroughly before suggesting or building solutions. - Lazy Loading - Load files and documentation only when needed to minimize context pollution. - Validation - Always validate workflow JSON syntax after creation. diff --git a/src/modules/autominator/workflows/create-workflow/instructions.md b/src/modules/autominator/workflows/create-workflow/instructions.md index 3e648889..2169f6fe 100644 --- a/src/modules/autominator/workflows/create-workflow/instructions.md +++ b/src/modules/autominator/workflows/create-workflow/instructions.md @@ -15,7 +15,7 @@ Summarize your understanding - Skip directly to Step 2 (Check Context7 MCP) + Skip directly to Step 2 (Research n8n Documentation) @@ -133,38 +133,36 @@ - - Check if Context7 MCP server is configured - Try to list available MCP tools + + Search for up-to-date n8n documentation based on user requirements - - Store true in {{context7_available}} - Proceed to Step 3 - + Inform user: "Researching n8n documentation for your workflow requirements..." - - Store false in {{context7_available}} - Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation." - Recommend: "For best results, install Context7 MCP server in your IDE. See: https://github.com/context7/context7" - Inform: "Proceeding with built-in n8n knowledge." - Proceed to Step 4 - + Perform web search for n8n documentation on: + 1. Trigger type: {{trigger_type}} + 2. Integrations: {{integrations}} + 3. Conditional logic: {{conditional_logic}} + 4. Error handling: {{criticality}} + + Search queries to use: + - "n8n [trigger_type] node documentation" + - "n8n [integration] node setup" + - "n8n workflow best practices" + - "n8n error handling retry logic" + + Focus on official n8n documentation at docs.n8n.io + Store relevant documentation snippets for reference + Note any specific node configurations or parameters needed - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Workflow type: {{workflow_type}} - - Integrations: {{integrations}} - - Complexity: {{complexity}} - Store relevant documentation snippets for reference - + + Summarize key findings from documentation: + - Available node types for requirements + - Required parameters and configurations + - Best practices for this use case + - Any limitations or considerations - - Skip Context7 query - Use built-in knowledge and templates - + Inform user: "Based on n8n documentation, I found the necessary nodes and configurations for your workflow." diff --git a/src/modules/autominator/workflows/create-workflow/workflow.yaml b/src/modules/autominator/workflows/create-workflow/workflow.yaml index 6f91fb8f..4bc06600 100644 --- a/src/modules/autominator/workflows/create-workflow/workflow.yaml +++ b/src/modules/autominator/workflows/create-workflow/workflow.yaml @@ -23,7 +23,6 @@ variables: save_location: "" # Will be elicited workflow_name: "" # Will be elicited additional_requirements: "" # Will be elicited - context7_available: false # Will be checked default_output_file: "{project-root}/workflows/workflow-{timestamp}.json" diff --git a/src/modules/autominator/workflows/migrate-workflow/instructions.md b/src/modules/autominator/workflows/migrate-workflow/instructions.md index b427c510..be2f9486 100644 --- a/src/modules/autominator/workflows/migrate-workflow/instructions.md +++ b/src/modules/autominator/workflows/migrate-workflow/instructions.md @@ -15,7 +15,7 @@ Summarize your understanding - Skip directly to Step 2 (Check Context7 MCP) + Skip directly to Step 2 (Research n8n Documentation for Migration) @@ -126,31 +126,35 @@ Store final path in {{save_location}} - - Check if Context7 MCP server is configured - Try to list available MCP tools + + Search for n8n documentation relevant to migration requirements - - Store true in {{context7_available}} - Proceed to Step 3 - + Inform user: "Researching n8n documentation for migration from {{source_platform}}..." - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge." - Proceed to Step 4 - + Perform web search for: + 1. n8n equivalents for {{source_platform}} features + 2. Integration nodes: {{integrations_used}} + 3. Migration best practices + 4. Platform-specific considerations + + Search queries to use: + - "n8n migrate from [source_platform]" + - "n8n [integration] node documentation" + - "n8n vs [source_platform] comparison" + - "n8n workflow migration guide" + + Focus on official n8n documentation at docs.n8n.io + Store relevant migration patterns and node configurations - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Integrations used: {{integrations_used}} - - Trigger type: {{trigger_type}} - - Source platform: {{source_platform}} - Store relevant documentation snippets for reference - + + Summarize migration strategy based on documentation: + - n8n equivalents for {{source_platform}} features + - Required node types and configurations + - Data transformation needs + - Any migration challenges or limitations + + Inform user: "Based on n8n documentation, I've identified the migration path from {{source_platform}}." diff --git a/src/modules/autominator/workflows/migrate-workflow/workflow.yaml b/src/modules/autominator/workflows/migrate-workflow/workflow.yaml index d0fa5839..5b7f8731 100644 --- a/src/modules/autominator/workflows/migrate-workflow/workflow.yaml +++ b/src/modules/autominator/workflows/migrate-workflow/workflow.yaml @@ -24,7 +24,6 @@ variables: complexity: "" # Will be elicited save_location: "" # Will be elicited workflow_name: "" # Will be elicited - context7_available: false # Will be checked default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json" diff --git a/src/modules/autominator/workflows/modify-workflow/instructions.md b/src/modules/autominator/workflows/modify-workflow/instructions.md index 9fcc2e8a..2dd85a8c 100644 --- a/src/modules/autominator/workflows/modify-workflow/instructions.md +++ b/src/modules/autominator/workflows/modify-workflow/instructions.md @@ -143,31 +143,34 @@ Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}" - - Check if Context7 MCP server is configured - Try to list available MCP tools + + Search for n8n documentation relevant to the modifications needed - - Store true in {{context7_available}} - Proceed to Step 5 - + Inform user: "Researching n8n documentation for your modifications..." - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Proceeding with built-in knowledge." - Proceed to Step 6 - + Perform web search based on modification needs: + - Problem to solve: {{problem_to_solve}} + - Specific changes: {{specific_changes}} + - Desired behavior: {{desired_behavior}} + + Search queries to use: + - "n8n [specific feature] documentation" + - "n8n [node type] configuration" + - "n8n workflow modification best practices" + - "n8n [integration] setup" + + Focus on official n8n documentation at docs.n8n.io + Store relevant node configurations and modification patterns - - - Resolve n8n library ID using Context7 - Query Context7 for relevant n8n documentation based on: - - Modification type: {{modification_type}} - - Nodes to add: {{nodes_to_add}} - - Changes description: {{changes_description}} - Store relevant documentation snippets for reference - + + Summarize modification strategy based on documentation: + - How to implement {{desired_behavior}} + - Required node changes or additions + - Configuration updates needed + - Best practices for these modifications + + Inform user: "Based on n8n documentation, I've identified how to implement your changes." diff --git a/src/modules/autominator/workflows/modify-workflow/workflow.yaml b/src/modules/autominator/workflows/modify-workflow/workflow.yaml index 1822a0bf..5f6ed1a6 100644 --- a/src/modules/autominator/workflows/modify-workflow/workflow.yaml +++ b/src/modules/autominator/workflows/modify-workflow/workflow.yaml @@ -22,7 +22,6 @@ variables: nodes_to_modify: [] # Will be elicited nodes_to_remove: [] # Will be elicited backup_created: false # Will be set - context7_available: false # Will be checked default_output_file: "" # Will use existing file location diff --git a/src/modules/autominator/workflows/optimize-workflow/instructions.md b/src/modules/autominator/workflows/optimize-workflow/instructions.md index caadb25a..13546e35 100644 --- a/src/modules/autominator/workflows/optimize-workflow/instructions.md +++ b/src/modules/autominator/workflows/optimize-workflow/instructions.md @@ -144,30 +144,37 @@ - Integrations: [list of services] - - Check if Context7 MCP server is configured - Try to list available MCP tools + + Search for n8n documentation on optimization and best practices - - Store true in {{context7_available}} - Proceed to Step 4 - + Inform user: "Researching n8n best practices and optimization techniques..." - - Store false in {{context7_available}} - Inform user: "Context7 MCP not configured. Using built-in n8n best practices." - Proceed to Step 5 - + Perform web search for: + 1. n8n performance optimization + 2. n8n error handling best practices + 3. n8n workflow structure patterns + 4. n8n security best practices + 5. Solutions for: {{problems_experienced}} + + Search queries to use: + - "n8n workflow optimization best practices" + - "n8n performance tuning" + - "n8n error handling patterns" + - "n8n workflow security" + - "n8n [specific problem] solution" + + Focus on official n8n documentation at docs.n8n.io + Store relevant optimization techniques and best practices - - - Resolve n8n library ID using Context7 - Query Context7 for n8n best practices documentation - Query for optimization techniques - Query for performance tips - Store relevant documentation for reference - + + Summarize optimization approach based on documentation: + - Solutions for {{problems_experienced}} + - Best practices to apply + - Performance improvements available + - Expected impact on {{business_impact}} + + Inform user: "Based on n8n best practices, I've identified optimization opportunities." diff --git a/src/modules/autominator/workflows/optimize-workflow/workflow.yaml b/src/modules/autominator/workflows/optimize-workflow/workflow.yaml index 2e013480..c0d7dfe1 100644 --- a/src/modules/autominator/workflows/optimize-workflow/workflow.yaml +++ b/src/modules/autominator/workflows/optimize-workflow/workflow.yaml @@ -21,7 +21,6 @@ variables: recommendations: [] # Will be generated apply_changes: false # Will be elicited backup_created: false # Will be set - context7_available: false # Will be checked default_output_file: "" # Will use existing file location From 82b4f1dcb4e81feea570f290a8fc2ec4d0639293 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Sat, 22 Nov 2025 12:22:42 +0500 Subject: [PATCH 13/16] feat(autominator): add gather-requirements workflow for requirement gathering - Create gather-requirements workflow with interactive elicitation - Add web search integration after each question - Research EXACT node types, typeVersions, and parameter structures from docs.n8n.io - Store all research findings in requirements file - Generate requirement documents with research sections - Add template.md with research findings sections - Add instructions.md with comprehensive elicitation steps - Add checklist.md for validation --- .../gather-requirements/checklist.md | 25 +++ .../gather-requirements/instructions.md | 190 ++++++++++++++++++ .../workflows/gather-requirements/template.md | 75 +++++++ .../gather-requirements/workflow.yaml | 34 ++++ 4 files changed, 324 insertions(+) create mode 100644 src/modules/autominator/workflows/gather-requirements/checklist.md create mode 100644 src/modules/autominator/workflows/gather-requirements/instructions.md create mode 100644 src/modules/autominator/workflows/gather-requirements/template.md create mode 100644 src/modules/autominator/workflows/gather-requirements/workflow.yaml diff --git a/src/modules/autominator/workflows/gather-requirements/checklist.md b/src/modules/autominator/workflows/gather-requirements/checklist.md new file mode 100644 index 00000000..d56d9dc2 --- /dev/null +++ b/src/modules/autominator/workflows/gather-requirements/checklist.md @@ -0,0 +1,25 @@ +# Gather Requirements - Validation Checklist + +## Requirements Completeness + +- [ ] Problem statement is clear and specific +- [ ] Trigger type is defined +- [ ] Data requirements are documented +- [ ] Desired outcome is clear +- [ ] All integrations are listed +- [ ] Conditional logic is documented (or marked as not needed) +- [ ] Criticality level is set +- [ ] Workflow name is descriptive + +## Document Quality + +- [ ] Requirements file is saved to correct location +- [ ] All template fields are filled +- [ ] No placeholder text remains +- [ ] Change log is initialized + +## Readiness + +- [ ] Requirements are sufficient to create workflow +- [ ] User has confirmed requirements are correct +- [ ] File is ready for use by create-workflow diff --git a/src/modules/autominator/workflows/gather-requirements/instructions.md b/src/modules/autominator/workflows/gather-requirements/instructions.md new file mode 100644 index 00000000..3530d56a --- /dev/null +++ b/src/modules/autominator/workflows/gather-requirements/instructions.md @@ -0,0 +1,190 @@ +# Gather Requirements - Workflow Instructions + +```xml +The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml +You MUST have already loaded and processed: {installed_path}/workflow.yaml +This workflow gathers requirements for n8n workflow creation. + + + + + Resolve variables from config_source: requirements_folder, output_folder, user_name, communication_language + Create {{requirements_folder}} directory if it does not exist + Load template from {{template}} + + + + Ask questions ONE AT A TIME and WAIT for user response after each question + + Question 1: What problem are you trying to solve with this automation? + +Describe the current manual process, pain points, and desired outcome. + WAIT for user input + Store response in {{problem_description}} + + Perform web search to understand the use case: + - "n8n workflow for [problem description] site:docs.n8n.io" + - "n8n automation [problem description] best practices" + Store findings in {{use_case_research}} + + Question 2: What triggers this process? When should the automation run? + +Options: +1. When data arrives - Webhook, form submission, API call +2. On a schedule - Every hour, daily, weekly, custom cron +3. When something changes - Database update, file change, service event +4. Manually - On-demand execution +5. Multiple triggers - Combination of above +6. Not sure - Help me decide based on my problem + +Enter your selection (1-6): + WAIT for user input + Store response in {{trigger_type}} + + + Analyze {{problem_description}} and suggest appropriate trigger + Based on your problem, I recommend [trigger type]. Does this make sense? (yes/no) + WAIT for confirmation + Store final trigger in {{trigger_type}} + + + Question 3: What data or information does this workflow need to work with? + +Examples: Customer data, order details, form responses, API data, etc. + WAIT for user input + Store response in {{data_requirements}} + + Question 4: What should happen with this data? What's the desired outcome? + +Examples: Send to Slack, update database, create invoice, notify team, etc. + WAIT for user input + Store response in {{desired_outcome}} + + Question 5: What services or systems are involved? + +Examples: Slack, Google Sheets, PostgreSQL, HubSpot, custom API, etc. + WAIT for user input + Store response in {{integrations}} + + Research EXACT n8n node types for each integration: + For each service in {{integrations}}: + 1. Search: "n8n [service] node documentation site:docs.n8n.io" + 2. Extract EXACT node type string (e.g., "n8n-nodes-base.webhook") + 3. Extract typeVersion (e.g., 2.1) + 4. Extract available parameters structure + 5. Extract example usage from docs + 6. Note if trigger node or action node + Store all findings in {{node_research}} + + Question 6: Are there any conditions or decision points in this process? + +Examples: If amount > $1000, notify manager; If status = 'urgent', send immediately + +Options: +1. No - Straight-through processing +2. Yes - Describe the conditions + +Enter your selection (1-2): + WAIT for user input + + Describe the conditions and what should happen in each case: + WAIT for user input + Store response in {{conditional_logic}} + + + Store "No conditional logic required" in {{conditional_logic}} + + + Question 7: How critical is this workflow? What happens if it fails? + +Options: +1. Low - Can retry manually if needed +2. Medium - Should retry automatically, notify on failure +3. High - Must succeed, need alerts and logging +4. Critical - Business-critical, need comprehensive error handling + +Enter your selection (1-4): + WAIT for user input + Store selection in {{criticality}} + + Question 8: What should the workflow be named? + WAIT for user input + Store response in {{workflow_name}} + Generate {{workflow_slug}} from {{workflow_name}} (lowercase, hyphens, no spaces) + + Display summary: +- Problem: {{problem_description}} +- Trigger: {{trigger_type}} +- Data: {{data_requirements}} +- Outcome: {{desired_outcome}} +- Services: {{integrations}} +- Conditions: {{conditional_logic}} +- Criticality: {{criticality}} +- Name: {{workflow_name}} + + + Does this capture your requirements correctly? + +Options: +1. Yes - Save requirements +2. No - Let me clarify or add details + +Enter your selection (1-2): + WAIT for user input + + What needs to be clarified or added? + WAIT for user input + Update relevant variables based on feedback + Repeat summary and confirmation + + + + + Perform comprehensive web search for workflow pattern: + - "n8n workflow pattern [trigger_type] to [desired_outcome] site:docs.n8n.io" + - "n8n [integrations] workflow example site:docs.n8n.io" + - "n8n best practices [use case] site:docs.n8n.io" + Store findings in {{workflow_pattern_research}} + + Research parameter structures for each node type: + For each node type in {{node_research}}: + 1. Search: "n8n [node type] parameters documentation site:docs.n8n.io" + 2. Extract EXACT parameter structure from docs + 3. Extract required vs optional parameters + 4. Extract parameter data types + 5. Extract example values + Store in {{parameter_structures}} + + + + Resolve output path: {{default_output_file}} using {{workflow_slug}} + Fill template with all gathered variables AND research findings + Include in document: + - Problem description and requirements + - Use case research findings + - EXACT node types with typeVersions + - EXACT parameter structures from docs + - Workflow pattern recommendations + - Best practices from research + Save document to {{default_output_file}} + Report saved file path to user + + ✅ Requirements Saved Successfully! + +**File:** {{default_output_file}} + +**Next Steps:** +1. Review the requirements file +2. Run `*create-workflow` to generate the n8n workflow + (The create-workflow will automatically load this requirements file) + +**Note:** You can edit the requirements file manually before creating the workflow. + + + + + Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml + + + +``` diff --git a/src/modules/autominator/workflows/gather-requirements/template.md b/src/modules/autominator/workflows/gather-requirements/template.md new file mode 100644 index 00000000..2a58e61a --- /dev/null +++ b/src/modules/autominator/workflows/gather-requirements/template.md @@ -0,0 +1,75 @@ +# Workflow Requirements: {{workflow_name}} + +**Created:** {{date}} +**Status:** Requirements Gathered +**Criticality:** {{criticality}} + +--- + +## Problem Statement + +{{problem_description}} + +--- + +## Workflow Overview + +**Trigger:** {{trigger_type}} + +**Desired Outcome:** {{desired_outcome}} + +--- + +## Data Requirements + +{{data_requirements}} + +--- + +## Integrations + +{{integrations}} + +--- + +## Conditional Logic + +{{conditional_logic}} + +--- + +## Research Findings + +### Use Case Research + +{{use_case_research}} + +### Node Types (From n8n Documentation) + +{{node_research}} + +### Parameter Structures (From n8n Documentation) + +{{parameter_structures}} + +### Workflow Pattern Recommendations + +{{workflow_pattern_research}} + +--- + +## Technical Notes + +- Requirements gathered: {{date}} +- Research completed from n8n documentation +- All node types and parameters verified from docs.n8n.io +- Ready for workflow creation +- Use this file as input for `*create-workflow` + +--- + +## Change Log + +| Date | Change | Author | +| -------- | ----------------------------- | ------------- | +| {{date}} | Initial requirements gathered | {{user_name}} | diff --git a/src/modules/autominator/workflows/gather-requirements/workflow.yaml b/src/modules/autominator/workflows/gather-requirements/workflow.yaml new file mode 100644 index 00000000..3762961c --- /dev/null +++ b/src/modules/autominator/workflows/gather-requirements/workflow.yaml @@ -0,0 +1,34 @@ +name: gather-requirements +description: "Gather and document workflow requirements before creating n8n workflow" +author: "Saif" + +# Critical variables from config +config_source: "{project-root}/{bmad_folder}/autominator/config.yaml" +output_folder: "{config_source}:output_folder" +user_name: "{config_source}:user_name" +communication_language: "{config_source}:communication_language" +requirements_folder: "{config_source}:requirements_folder" +date: system-generated + +# Workflow components +installed_path: "{project-root}/{bmad_folder}/autominator/workflows/gather-requirements" +template: "{installed_path}/template.md" +instructions: "{installed_path}/instructions.md" +validation: "{installed_path}/checklist.md" + +# Variables +variables: + workflow_name: "" # Will be elicited + workflow_slug: "" # Generated from workflow_name + problem_description: "" # Will be elicited + trigger_type: "" # Will be elicited + data_requirements: "" # Will be elicited + desired_outcome: "" # Will be elicited + integrations: "" # Will be elicited + conditional_logic: "" # Will be elicited + criticality: "" # Will be elicited + +default_output_file: "{requirements_folder}/req-{workflow_slug}.md" + +standalone: true +web_bundle: false From 36ce3c42d28f4cb8a258e6c27221320754ad601c Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Sat, 22 Nov 2025 12:23:51 +0500 Subject: [PATCH 14/16] feat(autominator): implement research-driven node and workflow building --- .../workflows/create-workflow/instructions.md | 162 +++++++++++++----- 1 file changed, 121 insertions(+), 41 deletions(-) diff --git a/src/modules/autominator/workflows/create-workflow/instructions.md b/src/modules/autominator/workflows/create-workflow/instructions.md index 2169f6fe..e9bb43b3 100644 --- a/src/modules/autominator/workflows/create-workflow/instructions.md +++ b/src/modules/autominator/workflows/create-workflow/instructions.md @@ -7,24 +7,74 @@ - - Before asking any questions, analyze what the user has already told you + + Load configuration and check for requirements file before proceeding - Review the user's initial request and conversation history - Extract any mentioned: workflow type, trigger, integrations, complexity, requirements + Resolve variables from config_source: workflows_folder, requirements_folder, output_folder, user_name, communication_language + Create {{workflows_folder}} directory if it does not exist + Create {{requirements_folder}} directory if it does not exist - - Summarize your understanding - Skip directly to Step 2 (Research n8n Documentation) + Search for requirements files in {{requirements_folder}} + List all files matching pattern: req-*.md + + + ⚠️ No Requirements File Found + +Before creating a workflow, you need to gather requirements. + +**Options:** +1. Run `*gather-requirements` to create a requirements file +2. Provide requirements manually in this session + +Would you like to: +a) Run gather-requirements workflow now +b) Continue without requirements file (manual elicitation) + +Enter your choice (a/b): + WAIT for user input + + + Invoke workflow: {project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml + After gather-requirements completes, reload this step to find the new requirements file + + + + Set {{requirements_file}} = empty + Proceed to Step 1 for manual elicitation + - - Note what you already know - Only ask about missing information in Step 1 + + Set {{requirements_file}} to the found file path + Load and parse requirements file COMPLETELY + Extract requirements: workflow_name, problem_description, trigger_type, data_requirements, desired_outcome, integrations, conditional_logic, criticality + Extract research findings: use_case_research, node_research, parameter_structures, workflow_pattern_research + Display loaded requirements summary to user + Skip to Step 4 (Plan Workflow Structure) - research already done - - Proceed with full elicitation in Step 1 + + 📋 Multiple Requirements Files Found: + +[Display numbered list of files with workflow names] + +Which requirements file would you like to use? +Enter the number (1-N) or 'new' to create a new one: + WAIT for user input + + + Set {{requirements_file}} to selected file path + Load and parse requirements file COMPLETELY + Extract requirements: workflow_name, problem_description, trigger_type, data_requirements, desired_outcome, integrations, conditional_logic, criticality + Extract research findings: use_case_research, node_research, parameter_structures, workflow_pattern_research + Display loaded requirements summary to user + Skip to Step 4 (Plan Workflow Structure) - research already done + + + + Invoke workflow: {project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml + After gather-requirements completes, reload this step to find the new requirements file + @@ -242,59 +292,80 @@ - Follow guidelines from {{helpers}} for proper node creation + Use EXACT node types and parameter structures from {{node_research}} and {{parameter_structures}} + Follow modern n8n format from {{helpers}} - Initialize workflow structure: + Initialize workflow structure with modern n8n format: { "name": "{{workflow_name}}", "nodes": [], + "pinData": {}, "connections": {}, "active": false, "settings": { "executionOrder": "v1" }, + "versionId": "[generate UUID]", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "[generate UUID]" + }, + "id": "[generate short ID]", "tags": [] } Build nodes ONE at a time following these rules: - For Each Node: - 1. Generate unique node ID + For Each Node (Use EXACT structures from research): + 1. Generate UUID for node ID (format: "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92") 2. Set node name (unique, descriptive) - 3. Set node type (e.g., n8n-nodes-base.webhook) - 4. Set typeVersion (usually 1) - 5. Calculate position: - - First node (trigger): [250, 300] + 3. Use EXACT node type from {{node_research}}: + - MUST be format: "n8n-nodes-base.nodeName" + - NEVER use: "@n8n/n8n-nodes-*" format + - Example: "n8n-nodes-base.gmail" NOT "@n8n/n8n-nodes-gmail.gmail" + 4. Use EXACT typeVersion from {{node_research}}: + - MUST be INTEGER (2, 3, 4) + - NEVER use float (2.1, 3.4) + 5. Calculate position as INTEGER array: + - Format: [x, y] where x and y are integers + - First node (trigger): [240, 300] - Subsequent nodes: add 220 to x for each step - Branches: adjust y by ±100 - 6. Configure parameters based on node type - 7. Add credentials if needed - 8. Set error handling options if required: - - continueOnFail: true/false - - retryOnFail: true/false - - maxTries: number - - waitBetweenTries: milliseconds + 6. Use EXACT parameter structure from {{parameter_structures}}: + - For Set node (v3+): use assignments.assignments structure + - For Gmail node (v2+): use "message" parameter (NOT "text") + - For IF node (v2+): use conditions.conditions structure (NO "name" field in conditions) + - For Slack channel: use __rl flag with mode and cachedResultName + - Copy structure EXACTLY from research, don't modify + 7. Add webhookId (UUID) if node type is webhook + 8. Add credentials if needed + 9. Field order: parameters, id, name, type, typeVersion, position, webhookId, credentials + 10. Store node name in list for validation - For Each Connection: - 1. Identify source node name - 2. Identify target node name - 3. Create connection entry in connections object: - "Source Node Name": [ - [ - { - "node": "Target Node Name", - "type": "main", - "index": 0 - } + For Each Connection (CRITICAL FORMAT): + 1. Identify source node name (must match node "name" field exactly) + 2. Identify target node name (must match node "name" field exactly) + 3. Create connection entry with CORRECT format: + "Source Node Name": { + "main": [ + [ + { + "node": "Target Node Name", + "type": "main", + "index": 0 + } + ] ] - ] - 4. For IF nodes: + } + 4. CRITICAL: The "main" wrapper object is REQUIRED + 5. NEVER use format: "Source": [[{...}]] (missing "main" wrapper) + 6. For IF nodes: - index 0 = true branch - index 1 = false branch - 5. Validate all referenced nodes exist + 7. Validate all referenced nodes exist in node names list Node Building Order: @@ -320,6 +391,15 @@ - Ensure proper spacing and alignment - Validate all required parameters are set + Resolve final save path: + + Use {{save_location}} as-is + + + Use {{workflows_folder}}/{{workflow_name}}.json + Ensure {{workflows_folder}} directory exists + Store resolved path in {{save_location}} + Save workflow to {{save_location}} From 8a91c6fffee5df0f5181de5e7cd32e4327a333cb Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Sat, 22 Nov 2025 12:24:16 +0500 Subject: [PATCH 15/16] fix(autominator): add critical format rules to n8n helpers --- .../workflows/_shared/n8n-helpers.md | 244 ++++++++++++++++-- 1 file changed, 224 insertions(+), 20 deletions(-) diff --git a/src/modules/autominator/workflows/_shared/n8n-helpers.md b/src/modules/autominator/workflows/_shared/n8n-helpers.md index d46aa1d6..195915a0 100644 --- a/src/modules/autominator/workflows/_shared/n8n-helpers.md +++ b/src/modules/autominator/workflows/_shared/n8n-helpers.md @@ -1,21 +1,51 @@ # n8n Workflow Helpers +## UUID Generation + +n8n uses UUIDs for node IDs, workflow IDs, and webhook IDs. Generate UUIDs in this format: + +**Full UUID (36 characters):** `f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92` + +- Used for: node `id`, `webhookId`, `versionId` +- Format: 8-4-4-4-12 hexadecimal characters with hyphens + +**Short ID (16 characters):** `Wvmqb0POKmqwCoKy` + +- Used for: workflow `id`, tag `id` +- Format: alphanumeric (a-z, A-Z, 0-9) + +**Assignment ID:** `id-1`, `id-2`, `id-3` + +- Used for: Set node assignments, IF node conditions +- Format: "id-" + sequential number + ## Node Creation Guidelines -### Basic Node Structure +### Basic Node Structure (Modern n8n Format) ```json { - "id": "unique-node-id", + "parameters": {}, + "id": "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92", "name": "Node Name", "type": "n8n-nodes-base.nodeName", - "typeVersion": 1, - "position": [x, y], - "parameters": {}, + "typeVersion": 2, + "position": [1424, 496], + "webhookId": "b5f0b784-2440-4371-bcf1-b59dd2b29e68", "credentials": {} } ``` +**Critical Rules:** + +- `parameters` comes FIRST +- `id` must be UUID format (e.g., "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92") +- `type` must be `n8n-nodes-base.nodeName` format (NOT @n8n/n8n-nodes-\*) +- `typeVersion` must be INTEGER (e.g., 2, 3, 4) NOT float (2.1, 3.4) +- `position` must be array of integers: [x, y] +- `webhookId` required for webhook nodes (UUID format) +- Field order matters for n8n compatibility + ### Node Positioning - Start node: [250, 300] @@ -25,12 +55,30 @@ ### Common Node Types +### ⚠️ CRITICAL: Node Type Format Rules + +**ALWAYS use format:** `n8n-nodes-base.nodeName` + +**NEVER use these formats:** + +- ❌ `@n8n/n8n-nodes-slack.slackTrigger` (wrong package format) +- ❌ `n8n-nodes-slack.slackTrigger` (missing base) +- ❌ `slackTrigger` (missing prefix) + +**Correct Examples:** + +- ✅ `n8n-nodes-base.webhook` +- ✅ `n8n-nodes-base.slackTrigger` +- ✅ `n8n-nodes-base.gmail` +- ✅ `n8n-nodes-base.if` + **Trigger Nodes:** - `n8n-nodes-base.webhook` - HTTP webhook trigger - `n8n-nodes-base.scheduleTrigger` - Cron/interval trigger - `n8n-nodes-base.manualTrigger` - Manual execution trigger - `n8n-nodes-base.emailTrigger` - Email trigger +- `n8n-nodes-base.slackTrigger` - Slack event trigger **Action Nodes:** @@ -44,7 +92,8 @@ **Integration Nodes:** - `n8n-nodes-base.googleSheets` - Google Sheets -- `n8n-nodes-base.slack` - Slack +- `n8n-nodes-base.slack` - Slack actions +- `n8n-nodes-base.gmail` - Gmail - `n8n-nodes-base.notion` - Notion - `n8n-nodes-base.airtable` - Airtable - `n8n-nodes-base.postgres` - PostgreSQL @@ -54,21 +103,56 @@ ### Connection Structure +### ⚠️ CRITICAL: Connection Format Rules + +**CORRECT Format:** + ```json { - "node": "Source Node Name", - "type": "main", - "index": 0 + "Source Node Name": { + "main": [ + [ + { + "node": "Target Node Name", + "type": "main", + "index": 0 + } + ] + ] + } +} +``` + +**WRONG Formats:** + +```json +// ❌ WRONG - Missing "main" wrapper +{ + "Source Node Name": [ + [ + { + "node": "Target Node Name", + "type": "main", + "index": 0 + } + ] + ] +} + +// ❌ WRONG - Direct array +{ + "Source Node Name": [[{...}]] } ``` ### Connection Rules 1. Each connection has a source node and target node -2. Main connections use type: "main" -3. Index 0 is default output, index 1+ for conditional branches -4. IF nodes have index 0 (true) and index 1 (false) -5. Always validate that referenced node names exist +2. Connections object structure: `{"Source": {"main": [[{...}]]}}` +3. The "main" key is REQUIRED (wraps the connection array) +4. Index 0 is default output, index 1+ for conditional branches +5. IF nodes have index 0 (true) and index 1 (false) +6. Always validate that referenced node names exist ### Connection Patterns @@ -116,26 +200,124 @@ Trigger → Split → [Branch1, Branch2, Branch3] → Merge ## Data Transformation Patterns -### Using Set Node +### Using Set Node (Modern Format - typeVersion 3+) ```json { "name": "Transform Data", "type": "n8n-nodes-base.set", + "typeVersion": 3, "parameters": { - "mode": "manual", - "values": { - "string": [ + "assignments": { + "assignments": [ { + "id": "id-1", "name": "outputField", - "value": "={{ $json.inputField }}" + "value": "={{ $json.inputField }}", + "type": "string" } ] + }, + "includeOtherFields": true, + "options": {} + } +} +``` + +**Critical Rules for Set Node:** + +- Use `assignments.assignments` structure (not `values`) +- Each assignment needs `id` field (e.g., "id-1", "id-2") +- Each assignment needs `type` field ("string", "number", "boolean") +- Include `includeOtherFields: true` to pass through other data +- Include `options: {}` for compatibility + +### Using Gmail Node (typeVersion 2+) + +```json +{ + "name": "Send Email", + "type": "n8n-nodes-base.gmail", + "typeVersion": 2, + "parameters": { + "sendTo": "user@example.com", + "subject": "Email Subject", + "message": "Email body content", + "options": {} + } +} +``` + +**Critical Rules for Gmail Node:** + +- Use `message` parameter (NOT `text`) +- Use `sendTo` (NOT `to`) +- Include `options: {}` for compatibility + +### Using Slack Node with Channel Selection + +```json +{ + "name": "Slack Action", + "type": "n8n-nodes-base.slack", + "typeVersion": 2, + "parameters": { + "channel": { + "__rl": true, + "value": "general", + "mode": "list", + "cachedResultName": "#general" } } } ``` +**Critical Rules for Slack Channel:** + +- Use `__rl: true` flag for resource locator +- Include `mode: "list"` for channel selection +- Include `cachedResultName` with # prefix + +### Using IF Node (typeVersion 2+) + +```json +{ + "name": "Check Condition", + "type": "n8n-nodes-base.if", + "typeVersion": 2, + "parameters": { + "conditions": { + "options": { + "caseSensitive": false, + "leftValue": "", + "typeValidation": "loose" + }, + "conditions": [ + { + "id": "id-1", + "leftValue": "={{ $json.field }}", + "rightValue": "value", + "operator": { + "type": "string", + "operation": "equals" + } + } + ], + "combinator": "and" + }, + "options": {} + } +} +``` + +**Critical Rules for IF Node:** + +- Use `conditions.conditions` structure +- Each condition needs `id` field +- Do NOT include `name` field in conditions +- Use `operator` object with `type` and `operation` +- Include `options` at root level + ### Using Code Node ```json @@ -171,7 +353,7 @@ Trigger → Split → [Branch1, Branch2, Branch3] → Merge - `httpHeaderAuth` - Header-based auth - `httpQueryAuth` - Query parameter auth -## Workflow Metadata +## Workflow Metadata (Modern n8n Format) ### Required Fields @@ -179,15 +361,37 @@ Trigger → Split → [Branch1, Branch2, Branch3] → Merge { "name": "Workflow Name", "nodes": [], + "pinData": {}, "connections": {}, "active": false, "settings": { "executionOrder": "v1" }, - "tags": [] + "versionId": "7d745171-e378-411c-bd0a-25a8368a1cb6", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "2229c21690ffe7e7b16788a579be3103980c4445acb933f7ced2a6a17f0bd18b" + }, + "id": "Wvmqb0POKmqwCoKy", + "tags": [ + { + "name": "Automation", + "id": "7FHIZPUaIaChwuiS", + "updatedAt": "2025-11-21T19:39:46.484Z", + "createdAt": "2025-11-21T19:39:46.484Z" + } + ] } ``` +**Critical Rules:** + +- `pinData` must be empty object `{}` +- `versionId` must be UUID +- `meta` object with `templateCredsSetupCompleted` and `instanceId` +- `id` must be short alphanumeric (e.g., "Wvmqb0POKmqwCoKy") +- `tags` must be array of objects (not strings) with id, name, createdAt, updatedAt + ## Validation Checklist - [ ] All node IDs are unique From f344e5cdc2a1d954528c4d35f9dcdef4028e6b04 Mon Sep 17 00:00:00 2001 From: mrsaifullah52 Date: Sat, 22 Nov 2025 12:24:58 +0500 Subject: [PATCH 16/16] feat(autominator): update agent menu and documentation --- src/modules/autominator/README.md | 58 +++++++++++++++---- .../autominator/agents/autominator.agent.yaml | 4 ++ .../workflows/create-workflow/workflow.yaml | 27 ++++++--- 3 files changed, 71 insertions(+), 18 deletions(-) diff --git a/src/modules/autominator/README.md b/src/modules/autominator/README.md index 7f009c17..499367d0 100644 --- a/src/modules/autominator/README.md +++ b/src/modules/autominator/README.md @@ -20,9 +20,25 @@ Autominator is an independent BMAD module that specializes in n8n workflow autom ## Workflows -### 1. Create Workflow +### 1. Gather Requirements -Build new n8n workflows from scratch based on your requirements. +Gather and document workflow requirements before creating n8n workflows. + +**Triggers:** + +- `*gather-requirements` + +**Features:** + +- Interactive requirement gathering +- Documents problem statement, triggers, integrations +- Creates requirement file for workflow creation +- Saves to `docs/workflow-requirements/` +- Required before creating workflows + +### 2. Create Workflow + +Build new n8n workflows from scratch based on requirements. **Triggers:** @@ -38,7 +54,7 @@ Build new n8n workflows from scratch based on your requirements. - Web search integration for latest n8n docs - Automatic JSON validation -### 2. Modify Workflow +### 3. Modify Workflow Edit or update existing n8n workflows with backup and safety checks. @@ -55,7 +71,7 @@ Edit or update existing n8n workflows with backup and safety checks. - Change validation - Rollback capability -### 3. Migrate Workflow +### 4. Migrate Workflow Migrate automation workflows from other platforms to n8n. @@ -81,7 +97,7 @@ Migrate automation workflows from other platforms to n8n. - Migration notes and documentation - Post-migration testing guidance -### 4. Optimize Workflow +### 5. Optimize Workflow Analyze and improve existing n8n workflows for performance and best practices. @@ -113,18 +129,38 @@ agent autominator/autominator *autominator ``` +### Gather Requirements (Recommended First Step) + +```bash +# Start the requirements gathering process +*gather-requirements + +# Follow the interactive prompts to: +# 1. Describe the problem you're solving +# 2. Define trigger type +# 3. Specify data requirements +# 4. Define desired outcome +# 5. List integrations +# 6. Define conditional logic +# 7. Set criticality level +# 8. Name the workflow + +# Requirements are saved to: docs/workflow-requirements/req-{name}.md +``` + ### Create a Workflow ```bash # Start the create workflow process *create-workflow -# Follow the interactive prompts to: -# 1. Describe your workflow type -# 2. Select integrations -# 3. Define complexity level -# 4. Configure error handling -# 5. Review and confirm +# Arnold will: +# 1. Check for requirements file (or prompt to create one) +# 2. Load requirements automatically +# 3. Research n8n documentation +# 4. Design workflow structure +# 5. Build and validate workflow JSON +# 6. Save to docs/workflows/{name}.json ``` ### Migrate from Another Platform diff --git a/src/modules/autominator/agents/autominator.agent.yaml b/src/modules/autominator/agents/autominator.agent.yaml index 6c8d3641..27072362 100644 --- a/src/modules/autominator/agents/autominator.agent.yaml +++ b/src/modules/autominator/agents/autominator.agent.yaml @@ -23,6 +23,10 @@ agent: - Structured Approach - Follow task-specific workflows for different automation scenarios. menu: + - trigger: gather-requirements + workflow: "{project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml" + description: Gather and document workflow requirements (run this first before creating workflows) + - trigger: create-workflow workflow: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow/workflow.yaml" description: Create new n8n workflow from scratch based on requirements diff --git a/src/modules/autominator/workflows/create-workflow/workflow.yaml b/src/modules/autominator/workflows/create-workflow/workflow.yaml index 4bc06600..6c0c95c5 100644 --- a/src/modules/autominator/workflows/create-workflow/workflow.yaml +++ b/src/modules/autominator/workflows/create-workflow/workflow.yaml @@ -2,6 +2,15 @@ name: create-workflow description: "Create new n8n workflow from scratch based on requirements" author: "Saif" +# Critical variables from config +config_source: "{project-root}/{bmad_folder}/autominator/config.yaml" +output_folder: "{config_source}:output_folder" +user_name: "{config_source}:user_name" +communication_language: "{config_source}:communication_language" +workflows_folder: "{config_source}:workflows_folder" +requirements_folder: "{config_source}:requirements_folder" +date: system-generated + # Workflow components installed_path: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow" shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared" @@ -15,16 +24,20 @@ platform_mappings: "{shared_path}/platform-mappings.yaml" # Variables variables: - workflow_type: "" # Will be elicited - trigger_type: "" # Will be elicited - integrations: [] # Will be elicited + requirements_file: "" # Will be discovered or elicited + workflow_type: "" # Will be loaded from requirements or elicited + trigger_type: "" # Will be loaded from requirements or elicited + integrations: [] # Will be loaded from requirements or elicited complexity: "" # Will be elicited error_handling: "" # Will be elicited - save_location: "" # Will be elicited - workflow_name: "" # Will be elicited - additional_requirements: "" # Will be elicited + workflow_name: "" # Will be loaded from requirements or elicited + problem_description: "" # Will be loaded from requirements + data_requirements: "" # Will be loaded from requirements + desired_outcome: "" # Will be loaded from requirements + conditional_logic: "" # Will be loaded from requirements + criticality: "" # Will be loaded from requirements -default_output_file: "{project-root}/workflows/workflow-{timestamp}.json" +default_output_file: "{workflows_folder}/{workflow_name}.json" standalone: true web_bundle: false