{
  "name": "Optimize Cold Email Copy with Claude, Instantly, and Google Sheets",
  "nodes": [
    {
      "id": "sticky-overview",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        0
      ],
      "parameters": {
        "width": 700,
        "height": 1262,
        "content": "## Self-Improving Cold Email Copy Optimizer\n\nInspired by [Karpathy's Autoresearch](https://github.com/karpathy/autoresearch), this workflow treats your cold email campaigns as continuous experiments. "
      }
    },
    {
      "id": "sticky-data",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        160
      ],
      "parameters": {
        "width": 550,
        "height": 100,
        "content": "### Data Collection\nPulls live stats from Instantly and reads current variants + experiment history from Google Sheets. Also reads the Program doc for Claude's rules."
      }
    },
    {
      "id": "sticky-evaluate",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        160
      ],
      "parameters": {
        "width": 400,
        "height": 116,
        "content": "### Threshold Check + Routing\nNeeds 200+ sends per variant before evaluating. If not enough data, the workflow exits cleanly. Three paths: first run, evaluate, or wait."
      }
    },
    {
      "id": "sticky-claude",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        160
      ],
      "parameters": {
        "width": 400,
        "height": 116,
        "content": "### AI Evaluation + Safety\nClaude analyzes both variants against 10 rounds of history. Generates new challenger with a hypothesis. Safety floor check pauses the loop if reply rate tanks."
      }
    },
    {
      "id": "sticky-deploy",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        160
      ],
      "parameters": {
        "width": 450,
        "height": 116,
        "content": "### Log + Deploy\nLogs full experiment to history sheet, promotes winner, deploys new challenger to Instantly. Every round compounds the knowledge base."
      }
    },
    {
      "id": "trigger-1",
      "name": "Run Every 6 Hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        496
      ]
    },
    {
      "id": "instantly-stats",
      "name": "Pull Instantly Campaign Stats",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        496
      ]
    },
    {
      "id": "sheets-read-experiments",
      "name": "Read Experiment History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        448,
        304
      ]
    },
    {
      "id": "sheets-read-active",
      "name": "Read Active Variants",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        448,
        496
      ]
    },
    {
      "id": "sheets-read-program",
      "name": "Read Program Doc",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        448,
        688
      ]
    },
    {
      "id": "code-merge",
      "name": "Merge Stats and History",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        496
      ]
    },
    {
      "id": "code-check-threshold",
      "name": "Check Data Threshold",
      "type": "n8n-nodes-base.code",
      "position": [
        896,
        496
      ]
    },
    {
      "id": "code-route",
      "name": "Route by Action",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        496
      ]
    },
    {
      "id": "code-safety-check",
      "name": "Safety Floor Check",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        496
      ]
    },
    {
      "id": "telegram-alert",
      "name": "Telegram Safety Alert",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1568,
        592
      ]
    },
    {
      "id": "claude-evaluate",
      "name": "Claude Evaluate and Generate",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1568,
        400
      ]
    },
    {
      "id": "code-parse",
      "name": "Parse Claude Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        400
      ]
    },
    {
      "id": "sheets-log",
      "name": "Log Experiment to History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2016,
        304
      ]
    },
    {
      "id": "sheets-update-active",
      "name": "Update Active Variants",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2016,
        496
      ]
    },
    {
      "id": "instantly-update",
      "name": "Update Instantly Campaign Copy",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        400
      ]
    }
  ],
  "connections": {
    "Route by Action": {
      "main": [
        [
          {
            "node": "Safety Floor Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Program Doc": {
      "main": [
        [
          {
            "node": "Merge Stats and History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Every 6 Hours": {
      "main": [
        [
          {
            "node": "Pull Instantly Campaign Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Safety Floor Check": {
      "main": [
        [
          {
            "node": "Claude Evaluate and Generate",
            "type": "main",
            "index": 0
          },
          {
            "node": "Telegram Safety Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Data Threshold": {
      "main": [
        [
          {
            "node": "Route by Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Active Variants": {
      "main": [
        [
          {
            "node": "Merge Stats and History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Claude Response": {
      "main": [
        [
          {
            "node": "Log Experiment to History",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update Active Variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Active Variants": {
      "main": [
        [
          {
            "node": "Update Instantly Campaign Copy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Stats and History": {
      "main": [
        [
          {
            "node": "Check Data Threshold",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Experiment History": {
      "main": [
        [
          {
            "node": "Merge Stats and History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Experiment to History": {
      "main": [
        [
          {
            "node": "Update Instantly Campaign Copy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Evaluate and Generate": {
      "main": [
        [
          {
            "node": "Parse Claude Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pull Instantly Campaign Stats": {
      "main": [
        [
          {
            "node": "Read Experiment History",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read Active Variants",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read Program Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}