{
  "name": "HikeWise Swarm Trigger",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 4
            }
          ]
        }
      },
      "id": "cron-trigger",
      "name": "Every 4 Hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "command": "cd /Users/jackenholland/AppDev/thetriage && python execution/swarm_coordinator.py --action run --max-agents 3"
      },
      "id": "run-swarm",
      "name": "Run Swarm Coordinator",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.exitCode }}",
              "value2": 0
            }
          ]
        }
      },
      "id": "check-success",
      "name": "Check Success",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "content": "=Swarm run completed successfully!\n\nOutput:\n{{ $json.stdout }}",
        "options": {}
      },
      "id": "success-note",
      "name": "Success Log",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        850,
        200
      ]
    },
    {
      "parameters": {
        "content": "=Swarm run failed!\n\nError:\n{{ $json.stderr }}",
        "options": {}
      },
      "id": "failure-note",
      "name": "Failure Log",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        850,
        400
      ]
    }
  ],
  "connections": {
    "Every 4 Hours": {
      "main": [
        [
          {
            "node": "Run Swarm Coordinator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Swarm Coordinator": {
      "main": [
        [
          {
            "node": "Check Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Success": {
      "main": [
        [
          {
            "node": "Success Log",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Failure Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "hikewise",
    "swarm",
    "automation"
  ]
}