{
  "name": "Agentic Architect · Weekly Signal Digest + Draft-First Review",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{ "field": "cronExpression", "expression": "0 7 * * 1" }]
        }
      },
      "id": "monday-trigger",
      "name": "Monday 7am Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [200, 300]
    },
    {
      "parameters": {
        "url": "https://hn.algolia.com/api/v1/search?query=MCP%20OR%20workflow%20agent&tags=story&hitsPerPage=8"
      },
      "id": "fetch-hn",
      "name": "Fetch Top Builder Signals",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [430, 220]
    },
    {
      "parameters": {
        "url": "https://www.reddit.com/r/smallbusiness/search.json?q=automate+workflow&restrict_sr=1&sort=new&limit=8"
      },
      "id": "fetch-reddit",
      "name": "Fetch Operator Bottleneck Questions",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [430, 380]
    },
    {
      "parameters": {
        "mode": "append"
      },
      "id": "merge-signals",
      "name": "Merge Builder & Operator Signals",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [670, 300]
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all().map(i => i.json);\nconst hnHits = (items[0]?.hits || []).map(h => `- [HN ${h.points || 0} pts] ${h.title} (${h.url || ''})`);\nconst redditPosts = (items[1]?.data?.children || []).map(c => `- [Reddit] ${c.data?.title}`);\nreturn [{ json: { combinedSignals: [...hnHits, ...redditPosts].join('\\n') } }];"
      },
      "id": "normalize-signals",
      "name": "Normalize Signal List",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [890, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"model\": \"gpt-4o-mini\",\n  \"temperature\": 0.3,\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"Rank the top 3 recurring workflow topics from these signals. For each, write: (1) Search-intent blog title, (2) Substack story angle, and (3) 3-sentence Substack Note draft with zero em-dashes.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": $json.combinedSignals\n    }\n  ]\n}"
      },
      "id": "llm-rank-topics",
      "name": "Rank Top 3 Topics & Draft Notes (LLM)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1120, 300]
    },
    {
      "parameters": {
        "resource": "draft",
        "subject": "Monday Editorial Signal Brief (Top 3 Scored Topics)",
        "message": "={{ $json.choices[0].message.content }}"
      },
      "id": "draft-digest",
      "name": "Stage Editorial Brief in Gmail Drafts",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [1360, 300]
    }
  ],
  "connections": {
    "Monday 7am Trigger": {
      "main": [
        [
          { "node": "Fetch Top Builder Signals", "type": "main", "index": 0 },
          { "node": "Fetch Operator Bottleneck Questions", "type": "main", "index": 0 }
        ]
      ]
    },
    "Fetch Top Builder Signals": {
      "main": [[{ "node": "Merge Builder & Operator Signals", "type": "main", "index": 0 }]]
    },
    "Fetch Operator Bottleneck Questions": {
      "main": [[{ "node": "Merge Builder & Operator Signals", "type": "main", "index": 1 }]]
    },
    "Merge Builder & Operator Signals": {
      "main": [[{ "node": "Normalize Signal List", "type": "main", "index": 0 }]]
    },
    "Normalize Signal List": {
      "main": [[{ "node": "Rank Top 3 Topics & Draft Notes (LLM)", "type": "main", "index": 0 }]]
    },
    "Rank Top 3 Topics & Draft Notes (LLM)": {
      "main": [[{ "node": "Stage Editorial Brief in Gmail Drafts", "type": "main", "index": 0 }]]
    }
  }
}
