AutomationFlowsGeneral › Wf-010 Parent Orchestrator Canonical

Wf-010 Parent Orchestrator Canonical

WF-010 Parent Orchestrator Canonical. Webhook trigger; 24 nodes.

Webhook trigger★★★★☆ complexity24 nodes
General Trigger: Webhook Nodes: 24 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "WF-010 Parent Orchestrator Canonical",
  "description": "Selects the route and orchestrates downstream Phase-1 workflow packs.",
  "nodes": [
    {
      "parameters": {
        "path": "wf-010-parent-orchestrator",
        "httpMethod": "POST",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "wf010_trigger_node",
      "name": "Trigger Node",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        200,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const raw = $json || {};\nconst input = (raw.body && typeof raw.body === 'object') ? raw.body : raw;\nconst dossier_id = input.dossier_id || input.dossierId || input.dossier_context?.dossier_id || 'DOSSIER-UNSPECIFIED';\nconst route_id = input.route_id || input.routeId || 'ROUTE_PHASE1_STANDARD';\nconst user_mode = input.user_mode || input.userMode || 'operator';\nconst intent_id = input.intent_id || input.intentId || 'unknown';\nconst user_message = input.user_message || input.userMessage || '';\nreturn [{ json: { ...input, ...$json, dossier_id, route_id, user_mode, intent_id, user_message, dossier_context: { dossier_id, route_id, loaded_at: new Date().toISOString() } } }];"
      },
      "id": "wf010_dossier_load_node",
      "name": "Dossier Load Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        420,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "return [{ json: { ...$json, registry_lookup: { workflow_registry: 'registries/workflow_registry.yaml', route_registry: 'registries/route_registry.yaml', skill_registry: 'registries/skill_registry.yaml', provider_registry: 'registries/provider_registry.yaml' } } }];"
      },
      "id": "wf010_registry_lookup_node",
      "name": "Registry Lookup Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        640,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const routeId = $json.route_id || 'ROUTE_PHASE1_STANDARD';\nlet nextWorkflow = 'WF-100';\nlet orchestration_decision = 'STANDARD_PATH';\nconst routeMap = {\n  'ROUTE_PHASE1_STANDARD': { next: 'CWF-110', pack: 'WF-100', decision: 'STANDARD_TOPIC_INTELLIGENCE' },\n  'ROUTE_PHASE1_FAST': { next: 'CWF-110', pack: 'WF-100', decision: 'FAST_PATH_TOPIC_INTELLIGENCE' },\n  'ROUTE_PHASE1_REPLAY': { next: $json.replay_target_workflow || 'CWF-110', pack: 'WF-100', decision: 'REPLAY_ROUTE_SELECTED' }\n};\nconst routeConfig = routeMap[routeId] || routeMap['ROUTE_PHASE1_STANDARD'];\nnextWorkflow = routeConfig.next;\norchestration_decision = routeConfig.decision;\nreturn [{\n  json: {\n    ...$json,\n    orchestration_decision: {\n      route_selected: routeId,\n      next_workflow: nextWorkflow,\n      next_pack: routeConfig.pack,\n      decision: orchestration_decision,\n      repo_present: true,\n      approval_gates_pending: ['topic_research_gate', 'script_approval_gate']\n    }\n  }\n}];"
      },
      "id": "wf010_route_selection_node",
      "name": "Route Selection Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        860,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "try {\n  const decision = $json.orchestration_decision;\n  if (!decision || !decision.route_selected || !decision.next_workflow) {\n    throw new Error('missing orchestration decision fields');\n  }\n  return [{ json: { ...$json, validation_status: 'SUCCESS', route_to_error: false } }];\n} catch (error) {\n  return [{ json: { ...$json, validation_status: 'FAILED', route_to_error: true, validation_error: String(error.message || error) } }];\n}"
      },
      "id": "wf010_orchestration_validation_node",
      "name": "Orchestration Validation Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1080,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "if ($json.route_to_error) return [];\nconst fs = require('fs');\nconst path = require('path');\n\nconst now = new Date().toISOString();\nconst dossierId = $json.dossier_id || ($json.dossier_context && $json.dossier_context.dossier_id) || 'DOSSIER-UNSPECIFIED';\nconst routeSelected = ($json.orchestration_decision && $json.orchestration_decision.route_selected) || $json.route_id || 'ROUTE_PHASE1_STANDARD';\n\nconst repoRoot = 'C:/ShadowEmpire-Git';\nconst dossiersDir = path.join(repoRoot, 'dossiers');\nconst dataDir = path.join(repoRoot, 'data');\nconst dossierPath = path.join(dossiersDir, dossierId + '.json');\nconst indexPath = path.join(dataDir, 'se_dossier_index.json');\n\nif (!fs.existsSync(dossiersDir)) fs.mkdirSync(dossiersDir, { recursive: true });\nif (!fs.existsSync(dataDir)) fs.mkdirSync(dataDir, { recursive: true });\n\nlet dossier = {\n  dossier_id: dossierId,\n  route_id: routeSelected,\n  created_at: now,\n  status: 'active',\n  namespaces: {},\n  _version: 0,\n  _created_at: now,\n  _audit_trail: []\n};\nif (fs.existsSync(dossierPath)) {\n  try {\n    const parsed = JSON.parse(fs.readFileSync(dossierPath, 'utf8'));\n    dossier = {\n      ...dossier,\n      ...parsed,\n      namespaces: typeof parsed.namespaces === 'object' && parsed.namespaces ? parsed.namespaces : {},\n      _audit_trail: Array.isArray(parsed._audit_trail) ? parsed._audit_trail : []\n    };\n  } catch (e) {\n    throw new Error('WF-010 persistence failed: dossier parse error: ' + e.message);\n  }\n}\n\nconst runtimeNs = (dossier.namespaces.runtime && typeof dossier.namespaces.runtime === 'object') ? dossier.namespaces.runtime : {};\nconst runs = Array.isArray(runtimeNs.orchestration_runs) ? runtimeNs.orchestration_runs : [];\nruns.push({\n  timestamp: now,\n  workflow_id: 'WF-010',\n  route_selected: routeSelected,\n  decision: ($json.orchestration_decision && $json.orchestration_decision.decision) || 'STANDARD_PATH'\n});\nruntimeNs.orchestration_runs = runs;\nruntimeNs.last_orchestration_status = 'ORCHESTRATION_COMPLETE';\nruntimeNs.last_orchestration_at = now;\ndossier.namespaces.runtime = runtimeNs;\ndossier.current_workflow = 'WF-010';\ndossier.last_updated = now;\ndossier.status = 'ORCHESTRATION_COMPLETE';\ndossier._version = Number(dossier._version || 0) + 1;\ndossier._last_updated_at = now;\ndossier._audit_trail.push({\n  timestamp: now,\n  workflow_id: 'WF-010',\n  operation: 'ORCHESTRATION_UPDATE',\n  route_selected: routeSelected,\n  notes: 'append orchestration runtime state'\n});\n\nfs.writeFileSync(dossierPath, JSON.stringify(dossier, null, 2), 'utf8');\n\nlet index = {\n  table: 'se_dossier_index',\n  description: 'Index of all dossiers; updated by WF-001 and dossier_writer.',\n  records: [],\n  created_at: now,\n  last_updated: now\n};\nif (fs.existsSync(indexPath)) {\n  index = JSON.parse(fs.readFileSync(indexPath, 'utf8'));\n  index.records = Array.isArray(index.records) ? index.records : [];\n} else {\n  index.records = [];\n}\nconst existing = index.records.find((r) => r && r.dossier_id === dossierId);\nif (existing) {\n  existing.updated_at = now;\n  existing.status = 'active';\n  existing.route_id = routeSelected;\n  existing.source_workflow = 'WF-010 Parent Orchestrator Canonical';\n} else {\n  index.records.push({\n    dossier_id: dossierId,\n    status: 'active',\n    created_at: now,\n    updated_at: now,\n    route_id: routeSelected,\n    source_workflow: 'WF-010 Parent Orchestrator Canonical'\n  });\n}\nindex.last_updated = now;\nfs.writeFileSync(indexPath, JSON.stringify(index, null, 2), 'utf8');\n\nreturn [{\n  json: {\n    ...$json,\n    persistence: {\n      wf: 'WF-010',\n      dossier_path: dossierPath,\n      dossier_index_path: indexPath,\n      dossier_version: dossier._version,\n      persisted_at: now\n    },\n    dossier_write: {\n      mutation_type: 'update_status',\n      target: 'dossier.runtime',\n      timestamp: now,\n      writer_id: 'WF-010',\n      instance_id: dossierId,\n      new_status: 'ORCHESTRATION_COMPLETE',\n      audit_entry: 'route-selection and orchestration from WF-010'\n    }\n  }\n}];"
      },
      "id": "wf010_dossier_write_node",
      "name": "Dossier Update Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1300,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "if ($json.route_to_error) return [];\nreturn [{\n  json: {\n    ...$json,\n    se_route_runs_write: {\n      operation: 'record_workflow_execution',\n      workflow_id: 'WF-010',\n      dossier_id: $json.dossier_id,\n      route_id: $json.orchestration_decision.route_selected,\n      orchestration_decision: $json.orchestration_decision.decision,\n      execution_timestamp: new Date().toISOString(),\n      status: 'COMPLETED'\n    }\n  }\n}];"
      },
      "id": "wf010_route_runs_write_node",
      "name": "se_route_runs Write Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1520,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "dew5Cgkwi8MUtAH7",
          "mode": "id",
          "cachedResultName": "WF-100 Topic Intelligence Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf100_node",
      "name": "Execute WF-100 Topic Intelligence",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        1740,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf100_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\n\nacc[\"wf100_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf100_node",
      "name": "Capture WF-100 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1990,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "2lhY0gkl83tII3CI",
          "mode": "id",
          "cachedResultName": "WF-200 Script Intelligence Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf200_node",
      "name": "Execute WF-200 Script Intelligence",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        2240,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf200_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\nacc[\"wf200_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf200_node",
      "name": "Capture WF-200 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2490,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "xriY2ZiZST6jybeX",
          "mode": "id",
          "cachedResultName": "WF-300 Context Engineering Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf300_node",
      "name": "Execute WF-300 Context Engineering",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        2740,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf300_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-200 Result').first(); if (c) acc[\"wf200_result\"] = c.json[\"wf200_result\"] || c.json; } catch(e) {}\nacc[\"wf300_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf300_node",
      "name": "Capture WF-300 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2990,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "kL9mZo3pQ2xJ5nBv",
          "mode": "id",
          "cachedResultName": "WF-400 Media Production Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf400_node",
      "name": "Execute WF-400 Media Production",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        3240,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf400_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-200 Result').first(); if (c) acc[\"wf200_result\"] = c.json[\"wf200_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-300 Result').first(); if (c) acc[\"wf300_result\"] = c.json[\"wf300_result\"] || c.json; } catch(e) {}\nacc[\"wf400_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf400_node",
      "name": "Capture WF-400 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        3490,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "aB2cD4eF6gH8iJ0k",
          "mode": "id",
          "cachedResultName": "WF-500 Publishing Distribution Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf500_node",
      "name": "Execute WF-500 Publishing Distribution",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        3740,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf500_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-200 Result').first(); if (c) acc[\"wf200_result\"] = c.json[\"wf200_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-300 Result').first(); if (c) acc[\"wf300_result\"] = c.json[\"wf300_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-400 Result').first(); if (c) acc[\"wf400_result\"] = c.json[\"wf400_result\"] || c.json; } catch(e) {}\nacc[\"wf500_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf500_node",
      "name": "Capture WF-500 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        3990,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "xOeKLfjudlc8OFiB",
          "mode": "id",
          "cachedResultName": "WF-020 Final Approval Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf020_node",
      "name": "Execute WF-020 Final Approval",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        4490,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf020_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-200 Result').first(); if (c) acc[\"wf200_result\"] = c.json[\"wf200_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-300 Result').first(); if (c) acc[\"wf300_result\"] = c.json[\"wf300_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-400 Result').first(); if (c) acc[\"wf400_result\"] = c.json[\"wf400_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-500 Result').first(); if (c) acc[\"wf500_result\"] = c.json[\"wf500_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-600 Result').first(); if (c) acc[\"wf600_result\"] = c.json[\"wf600_result\"] || c.json; } catch(e) {}\nacc[\"wf020_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf020_node",
      "name": "Capture WF-020 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4740,
        300
      ]
    },
    {
      "parameters": {
        "source": "database",
        "workflowId": {
          "__rl": true,
          "value": "fXNkWYfVX214QC87",
          "mode": "id",
          "cachedResultName": "WF-600 Analytics Evolution Pack Canonical"
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "id": "wf010_execute_wf600_node",
      "name": "Execute WF-600 Analytics Evolution",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        4240,
        300
      ],
      "alwaysOutputData": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "jsCode": "// Capture wf600_result\nconst subOutput = $json || {};\nlet parentCtx = {};\ntry { parentCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst acc = { ...parentCtx, dossier_id: dossierCtx.dossier_id || parentCtx.dossier_id };\ntry { const c = $('Capture WF-100 Result').first(); if (c) acc[\"wf100_result\"] = c.json[\"wf100_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-200 Result').first(); if (c) acc[\"wf200_result\"] = c.json[\"wf200_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-300 Result').first(); if (c) acc[\"wf300_result\"] = c.json[\"wf300_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-400 Result').first(); if (c) acc[\"wf400_result\"] = c.json[\"wf400_result\"] || c.json; } catch(e) {}\ntry { const c = $('Capture WF-500 Result').first(); if (c) acc[\"wf500_result\"] = c.json[\"wf500_result\"] || c.json; } catch(e) {}\nacc[\"wf600_result\"] = {\n  status: (() => { const s = (subOutput.execution_status || subOutput.status || (subOutput.error ? 'ERROR' : '') || '').toString().toUpperCase(); return s || 'SUCCESS'; })(),\n  payload: subOutput.completion_packet || subOutput.payload || subOutput,\n  captured_at: new Date().toISOString()\n};\nreturn [{ json: acc }];"
      },
      "id": "wf010_capture_wf600_node",
      "name": "Capture WF-600 Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4490,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "if ($json.route_to_error) return [];\n// After full chain, build orchestration completion packet aggregating all pack results.\nlet plannerCtx = {};\ntry { plannerCtx = $('Route Selection Node').first().json || {}; } catch(e) {}\nlet dossierCtx = {};\ntry { dossierCtx = $('Dossier Load Node').first().json || {}; } catch(e) {}\nconst orchDecision = plannerCtx.orchestration_decision || {};\nconst dossierId = dossierCtx.dossier_id || plannerCtx.dossier_id || $json.dossier_id || 'DOSSIER-UNSPECIFIED';\nconst aggregated = $json || {};\nconst now = new Date().toISOString();\n\nconst completion_packet = {\n  instance_id: 'WF-010-COMP-' + Date.now(),\n  artifact_family: 'orchestration_decision',\n  schema_version: '1.0.0',\n  producer_workflow: 'WF-010',\n  dossier_ref: dossierId,\n  created_at: now,\n  status: 'CREATED',\n  payload: {\n    route_selected: orchDecision.route_selected || 'ROUTE_PHASE1_STANDARD',\n    next_workflow: orchDecision.next_workflow || 'WF-100',\n    orchestration_decision: orchDecision.decision || 'STANDARD_PATH',\n    approval_gates_pending: orchDecision.approval_gates_pending || [],\n    route_to_wf900: 'WF-900',\n    chain_results: {\n      wf100: aggregated.wf100_result || null,\n      wf200: aggregated.wf200_result || null,\n      wf300: aggregated.wf300_result || null,\n      wf020: aggregated.wf020_result || null,\n      wf600: aggregated.wf600_result || null\n    }\n  }\n};\n\nconst fs = require('fs');\nconst path = require('path');\nconst repoRoot = 'C:/ShadowEmpire-Git';\nconst dataDir = path.join(repoRoot, 'data');\nconst packetIndexPath = path.join(dataDir, 'se_packet_index.json');\nif (!fs.existsSync(dataDir)) fs.mkdirSync(dataDir, { recursive: true });\n\nlet index = { entries: [], total_entries: 0, last_updated: now };\nif (fs.existsSync(packetIndexPath)) {\n  const parsed = JSON.parse(fs.readFileSync(packetIndexPath, 'utf8'));\n  index = {\n    ...index,\n    ...parsed,\n    entries: Array.isArray(parsed.entries)\n      ? parsed.entries\n      : (Array.isArray(parsed.packets) ? parsed.packets : [])\n  };\n}\n\nindex.entries.push({\n  packet_id: completion_packet.instance_id,\n  instance_id: completion_packet.instance_id,\n  artifact_family: completion_packet.artifact_family,\n  schema_version: completion_packet.schema_version,\n  producer_workflow: completion_packet.producer_workflow,\n  dossier_ref: completion_packet.dossier_ref,\n  created_at: completion_packet.created_at,\n  status: completion_packet.status,\n  payload: completion_packet.payload\n});\nindex.total_entries = index.entries.length;\nindex.last_updated = now;\nfs.writeFileSync(packetIndexPath, JSON.stringify(index, null, 2), 'utf8');\n\nreturn [{\n  json: {\n    workflow_id: 'WF-010',\n    execution_status: 'SUCCESS',\n    completion_packet,\n    packet_persistence: {\n      packet_index_path: packetIndexPath,\n      packet_entries: index.entries.length,\n      persisted_at: now\n    }\n  }\n}];"
      },
      "id": "wf010_completion_packet_emission_node",
      "name": "Completion Packet Emission Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4590,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "if (!$json.route_to_error) return [];\nreturn [{\n  json: {\n    workflow_id: 'WF-010',\n    routing_decision: 'ERROR',\n    route_to_workflow: 'WF-900',\n    error_message: $json.validation_error || 'Orchestration validation failed',\n    closure: $json.parent_status_closure || null,\n    failure_packet: $json.orchestration_decision || null\n  }\n}];"
      },
      "id": "wf010_error_routing_node",
      "name": "Error Routing WF-900 Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1080,
        500
      ]
    },
    {
      "parameters": {
        "jsCode": "const statusOf = (v) => String(v || '').toUpperCase();\nconst normalize = (r) => statusOf(r?.status || r?.execution_status || (r?.error ? 'ERROR' : ''));\nconst required = {\n  wf100: $json.wf100_result || null,\n  wf200: $json.wf200_result || null,\n  wf300: $json.wf300_result || null,\n  wf020: $json.wf020_result || null,\n};\nconst optional = {\n  wf600: $json.wf600_result || null,\n};\nconst failedRequired = Object.entries(required)\n  .map(([k,v]) => ({ pack:k, status: normalize(v) || 'MISSING' }))\n  .filter((x) => !['SUCCESS','COMPLETED'].includes(x.status));\nconst failedOptional = Object.entries(optional)\n  .map(([k,v]) => ({ pack:k, status: normalize(v) || 'MISSING' }))\n  .filter((x) => x.status !== 'MISSING' && !['SUCCESS','COMPLETED'].includes(x.status));\nconst failed = [...failedRequired, ...failedOptional];\nconst routeToError = failed.length > 0;\nreturn [{\n  json: {\n    ...$json,\n    parent_status_closure: {\n      workflow_id: 'WF-010',\n      closure_status: routeToError ? 'FAILED' : 'SUCCESS',\n      checked_at: new Date().toISOString(),\n      required_checks: Object.keys(required),\n      optional_checks: Object.keys(optional),\n      failed_packs: failed\n    },\n    route_to_error: routeToError,\n    validation_error: routeToError ? ('Downstream pack status mismatch: ' + failed.map(f => f.pack + ':' + f.status).join(',')) : null\n  }\n}];"
      },
      "id": "wf010_parent_status_closure_node",
      "name": "Parent Status Closure Node",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        4320,
        300
      ]
    }
  ],
  "connections": {
    "Trigger Node": {
      "main": [
        [
          {
            "node": "Dossier Load Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dossier Load Node": {
      "main": [
        [
          {
            "node": "Registry Lookup Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Registry Lookup Node": {
      "main": [
        [
          {
            "node": "Route Selection Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Selection Node": {
      "main": [
        [
          {
            "node": "Orchestration Validation Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Orchestration Validation Node": {
      "main": [
        [
          {
            "node": "Dossier Update Node",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Routing WF-900 Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dossier Update Node": {
      "main": [
        [
          {
            "node": "se_route_runs Write Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "se_route_runs Write Node": {
      "main": [
        [
          {
            "node": "Execute WF-100 Topic Intelligence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-100 Topic Intelligence": {
      "main": [
        [
          {
            "node": "Capture WF-100 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-100 Result": {
      "main": [
        [
          {
            "node": "Execute WF-200 Script Intelligence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-200 Script Intelligence": {
      "main": [
        [
          {
            "node": "Capture WF-200 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-200 Result": {
      "main": [
        [
          {
            "node": "Execute WF-300 Context Engineering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-300 Context Engineering": {
      "main": [
        [
          {
            "node": "Capture WF-300 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-300 Result": {
      "main": [
        [
          {
            "node": "Execute WF-400 Media Production",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-400 Media Production": {
      "main": [
        [
          {
            "node": "Capture WF-400 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-400 Result": {
      "main": [
        [
          {
            "node": "Execute WF-500 Publishing Distribution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-500 Publishing Distribution": {
      "main": [
        [
          {
            "node": "Capture WF-500 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-500 Result": {
      "main": [
        [
          {
            "node": "Execute WF-600 Analytics Evolution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-600 Analytics Evolution": {
      "main": [
        [
          {
            "node": "Capture WF-600 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-600 Result": {
      "main": [
        [
          {
            "node": "Execute WF-020 Final Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute WF-020 Final Approval": {
      "main": [
        [
          {
            "node": "Capture WF-020 Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture WF-020 Result": {
      "main": [
        [
          {
            "node": "Parent Status Closure Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completion Packet Emission Node": {
      "main": [
        []
      ]
    },
    "Error Routing WF-900 Node": {
      "main": [
        []
      ]
    },
    "Parent Status Closure Node": {
      "main": [
        [
          {
            "node": "Completion Packet Emission Node",
            "type": "main",
            "index": 0
          },
          {
            "node": "Error Routing WF-900 Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "workflow_id": "WF-010",
    "phase": "phase1",
    "vein": "orchestration_vein",
    "purpose": "Parent orchestrator routing through stage packs.",
    "implementation_depth": "production_grade",
    "owner_director": "narada",
    "next_workflow": "WF-100",
    "canonical_file": "n8n/workflows/WF-010.json",
    "wf900_error_route": "WF-900",
    "phase2_chaining": {
      "applied_at": "2026-04-29",
      "pattern": "orchestrator_full_chain",
      "chain": [
        {
          "name": "WF-100 Topic Intelligence Pack Canonical",
          "live_id": "dew5Cgkwi8MUtAH7",
          "capture_field": "wf100_result"
        },
        {
          "name": "WF-200 Script Intelligence Pack Canonical",
          "live_id": "2lhY0gkl83tII3CI",
          "capture_field": "wf200_result"
        },
        {
          "name": "WF-300 Context Engineering Pack Canonical",
          "live_id": "xriY2ZiZST6jybeX",
          "capture_field": "wf300_result"
        },
        {
          "name": "WF-400 Media Production Pack Canonical",
          "live_id": "kL9mZo3pQ2xJ5nBv",
          "capture_field": "wf400_result"
        },
        {
          "name": "WF-500 Publishing Distribution Pack Canonical",
          "live_id": "aB2cD4eF6gH8iJ0k",
          "capture_field": "wf500_result"
        },
        {
          "name": "WF-600 Analytics Evolution Pack Canonical",
          "live_id": "fXNkWYfVX214QC87",
          "capture_field": "wf600_result"
        },
        {
          "name": "WF-020 Final Approval Canonical",
          "live_id": "xOeKLfjudlc8OFiB",
          "capture_field": "wf020_result"
        }
      ],
      "notes": "WF-010 ingress webhook now fires the full Phase-1 chain through n8n executeWorkflow nodes."
    }
  },
  "active": true
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

WF-010 Parent Orchestrator Canonical. Webhook trigger; 24 nodes.

Source: https://github.com/justkalpane/Shadow-Creator-OS-Phase_01/blob/0447c2f91c0b7669a61f768fac60fa911acf2cc5/n8n/workflows/WF-010.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

A production-ready authentication workflow implementing secure user registration, login, token verification, and refresh token mechanisms. Perfect for adding authentication to any application without

Crypto, Data Table, Execute Workflow Trigger
General

Portfolio Orchestrator. Uses httpRequest. Webhook trigger; 59 nodes.

HTTP Request
General

This n8n template demonstrates how a simple Multi-Layer Perceptron (MLP) neural network can predict housing prices. The prediction is based on four key features, processed through a three-layer model.

General

github code Try yourself

Google Calendar
General

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

N8N Nodes 1Shot