{
  "name": "Daily AI Research Agent",
  "settings": {},
  "staticData": {},
  "nodes": [
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 7,
              "minute": 0
            }
          ]
        }
      },
      "name": "Daily Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        200,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://gh-trending-api.herokuapp.com/repositories",
        "method": "GET"
      },
      "name": "GitHub Trending",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        400,
        100
      ]
    },
    {
      "parameters": {
        "functionCode": "return items.map(i => ({ json: { title: i.json.name, summary_raw: i.json.description || '', source: 'GitHub', score: i.json.stars || 0, url: i.json.url, type: 'repo' }}));"
      },
      "name": "Normalize GitHub",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        600,
        100
      ]
    },
    {
      "parameters": {
        "url": "https://hnrss.org/frontpage",
        "method": "GET"
      },
      "name": "Hacker News RSS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        400,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return items.filter(i => /ai|llm|agent|startup/i.test(i.json.title || '')).map(i => ({ json: { title: i.json.title, summary_raw: i.json.title, source: 'HackerNews', score: 100, url: i.json.link, type: 'news' }}));"
      },
      "name": "Filter HN",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "mode": "combine"
      },
      "name": "Merge Sources",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        800,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "return items.filter(i => i.json.summary_raw.length > 40).filter(i => !/crypto|nft|web3/i.test(i.json.summary_raw)).slice(0, 20);"
      },
      "name": "Signal Filter",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1000,
        200
      ]
    },
    {
      "parameters": {
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "method": "POST",
        "jsonParameters": true,
        "bodyParametersJson": "{\n  \"model\": \"llama3-70b-8192\",\n  \"messages\": [\n    {\"role\": \"system\", \"content\": \"You are a senior AI research analyst. Summarize each item with TL;DR, why it matters, and one tag.\"},\n    {\"role\": \"user\", \"content\": \"{{JSON.stringify($input.all())}}\"}\n  ]\n}",
        "headerParametersJson": "{\n  \"Authorization\": \"Bearer YOUR_GROQ_API_KEY\",\n  \"Content-Type\": \"application/json\"\n}"
      },
      "name": "Groq Summarization",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1200,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "return items.slice(0, 10);"
      },
      "name": "Top Results",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1400,
        200
      ]
    },
    {
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "text": "\ud83e\udde0 {{ $json.title }}\n\n{{ $json.tldr || '' }}\n\n\ud83d\udd16 {{ $json.tag || '' }} | {{ $json.source }}",
        "additionalFields": {
          "replyMarkup": "{\"inline_keyboard\":[[{\"text\":\"Read More\",\"url\":\"{{$json.url}}\"},{\"text\":\"\u2b50 Save\",\"callback_data\":\"save\"},{\"text\":\"\u274c Ignore\",\"callback_data\":\"ignore\"}]]}"
        }
      },
      "name": "Telegram Send",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1600,
        200
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fromEmail": "ai@yourcompany.com",
        "toEmail": "YOUR_EMAIL",
        "subject": "\ud83e\udde0 Daily AI Research Digest",
        "html": "<h2>\ud83e\udde0 Daily AI Research Digest</h2><p>Key AI updates delivered via Telegram.</p><hr><p><b>\ud83d\udca1 Tip of the Day \u2013 AI Cost Optimization</b><br>Batch prompts and aggressively filter inputs before LLM calls.</p>"
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1600,
        400
      ]
    }
  ],
  "connections": {
    "Daily Cron": {
      "main": [
        [
          {
            "node": "GitHub Trending",
            "type": "main",
            "index": 0
          },
          {
            "node": "Hacker News RSS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub Trending": {
      "main": [
        [
          {
            "node": "Normalize GitHub",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize GitHub": {
      "main": [
        [
          {
            "node": "Merge Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hacker News RSS": {
      "main": [
        [
          {
            "node": "Filter HN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter HN": {
      "main": [
        [
          {
            "node": "Merge Sources",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Sources": {
      "main": [
        [
          {
            "node": "Signal Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Signal Filter": {
      "main": [
        [
          {
            "node": "Groq Summarization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Summarization": {
      "main": [
        [
          {
            "node": "Top Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Top Results": {
      "main": [
        [
          {
            "node": "Telegram Send",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}