{
  "name": "Problem Radar - Find App Ideas People Will Pay For (local Ollama)",
  "nodes": [
    {
      "id": "325ec1d6-e38b-4fc6-86ce-82e074165a5d",
      "name": "Run Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "93a4b66a-33f7-4806-acd3-cc293ed487ba",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        220,
        0
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "cfg1",
              "name": "searxng_url",
              "type": "string",
              "value": "http://searxng:8080"
            },
            {
              "id": "cfg2",
              "name": "ollama_url",
              "type": "string",
              "value": "http://ollama:11434"
            },
            {
              "id": "cfg3",
              "name": "triage_model",
              "type": "string",
              "value": "qwen3:8b"
            },
            {
              "id": "cfg4",
              "name": "analysis_model",
              "type": "string",
              "value": "qwen3:14b"
            },
            {
              "id": "cfg5",
              "name": "num_ctx",
              "type": "number",
              "value": 8192
            },
            {
              "id": "cfg6",
              "name": "min_opportunity_score",
              "type": "number",
              "value": 60
            },
            {
              "id": "cfg7",
              "name": "drive_folder_id",
              "type": "string",
              "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID"
            },
            {
              "id": "cfg8",
              "name": "builder_profile",
              "type": "string",
              "value": "YOUR_BUILDER_PROFILE: describe your skills (languages, frameworks, databases, hosting), your weak spots (for example mobile, design, payments, sales) and your constraints (budget, hours per week, where you can host). The scoring and MVP plans are written for this person."
            },
            {
              "id": "cfg9",
              "name": "scoring_rules",
              "type": "string",
              "value": "You are a startup product analyst advising ONE solo developer on which software product to build and sell. Be skeptical and honest. Use only facts from the post and the search results; never invent product names or prices. Score each factor from 0 to 10 independently. The overall score is computed in code from your factor scores, so do not inflate any single factor. If a free or open-source project in the search results already covers most of the MVP, competition_gap_score must be 3 or lower. If the audience expects tools to be free (hobbyists, free-software users), wtp_score must be 3 or lower unless the post shows people paying. Reachability: 10 = buyers gather in a marketplace, app store or community where the product can be listed or found by search; 0 = only cold outreach or paid ads would work."
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "7ea2b765-9b18-4fcb-ae3c-4120ea80cc4a",
      "name": "Build App Chart Requests",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ],
      "parameters": {
        "jsCode": "// Rotate through 3 App Store categories a day using Apple's public RSS charts\nconst genres = [\n  { id: 6007, name: 'Productivity' }, { id: 6000, name: 'Business' }, { id: 6015, name: 'Finance' },\n  { id: 6013, name: 'Health & Fitness' }, { id: 6017, name: 'Education' }, { id: 6002, name: 'Utilities' },\n  { id: 6012, name: 'Lifestyle' }, { id: 6008, name: 'Photo & Video' }, { id: 6023, name: 'Food & Drink' },\n  { id: 6003, name: 'Travel' }, { id: 6020, name: 'Medical' }, { id: 6006, name: 'Reference' }\n];\nconst dayNum = Math.floor(Date.now() / 86400000);\nconst out = [];\nfor (let k = 0; k < 3; k++) {\n  const g = genres[(dayNum * 3 + k) % genres.length];\n  out.push({ json: { genre: g.name, url: 'https://itunes.apple.com/us/rss/topfreeapplications/limit=14/genre=' + g.id + '/json' } });\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "6d0ef97c-00b7-4cb9-940b-1eb93b47eacb",
      "name": "Fetch App Charts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        660,
        0
      ],
      "parameters": {
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "problem-radar-n8n/1.0"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "method": "GET",
        "options": {
          "batching": {
            "batch": {
              "batchInterval": 1000,
              "batchSize": 1
            }
          },
          "response": {
            "response": {
              "responseFormat": "json"
            }
          },
          "timeout": 20000
        },
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "url": "={{ $json.url }}"
      },
      "alwaysOutputData": true
    },
    {
      "id": "882aa679-ed45-47e4-a785-9acd47f846ff",
      "name": "Build Review Requests",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        0
      ],
      "parameters": {
        "jsCode": "// Pick mid-ranked apps (ranks 7-14) and request their most recent reviews\nconst genres = $('Build App Chart Requests').all();\nconst resp = $input.all();\nconst out = [];\nconst seen = {};\nconst parse = (j) => { try { return typeof j.data === 'string' ? JSON.parse(j.data) : j; } catch (e) { return {}; } };\nfor (let i = 0; i < resp.length; i++) {\n  const r = parse(resp[i].json || {});\n  const feed = r.feed || {};\n  const entries = Array.isArray(feed.entry) ? feed.entry : (feed.entry ? [feed.entry] : []);\n  entries.slice(6, 14).forEach((e) => {\n    const id = e && e.id && e.id.attributes && e.id.attributes['im:id'];\n    if (!id || seen[id]) return;\n    seen[id] = true;\n    out.push({ json: { app_id: id, app_name: (e['im:name'] && e['im:name'].label) || '', genre: (genres[i] && genres[i].json.genre) || '', url: 'https://itunes.apple.com/us/rss/customerreviews/page=1/id=' + id + '/sortby=mostrecent/json' } });\n  });\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      },
      "alwaysOutputData": true
    },
    {
      "id": "58e75805-b389-4354-81af-12f52ccb9116",
      "name": "Fetch App Reviews",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        1100,
        0
      ],
      "parameters": {
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "problem-radar-n8n/1.0"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "method": "GET",
        "options": {
          "batching": {
            "batch": {
              "batchInterval": 800,
              "batchSize": 1
            }
          },
          "response": {
            "response": {
              "responseFormat": "json"
            }
          },
          "timeout": 20000
        },
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "url": "={{ $json.url }}"
      },
      "alwaysOutputData": true
    },
    {
      "id": "3aeece8a-71b7-4b21-bd3a-36c0268a3801",
      "name": "Normalize Reviews",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1320,
        0
      ],
      "parameters": {
        "jsCode": "// Keep apps with at least two detailed 1-2 star reviews; one 'post' per app per month\nconst reqs = $('Build Review Requests').all();\nconst resp = $input.all();\nconst month = new Date().toISOString().slice(0, 7);\nconst parse = (j) => { try { return typeof j.data === 'string' ? JSON.parse(j.data) : j; } catch (e) { return {}; } };\nconst out = [];\nfor (let i = 0; i < resp.length; i++) {\n  const meta = (reqs[i] && reqs[i].json) || {};\n  if (!meta.app_id) continue;\n  const feed = parse(resp[i].json || {}).feed || {};\n  const entries = Array.isArray(feed.entry) ? feed.entry : (feed.entry ? [feed.entry] : []);\n  const reviews = entries.filter((e) => e && e['im:rating']);\n  const low = reviews.filter((e) => Number(e['im:rating'].label) <= 2 && String((e.content && e.content.label) || '').length >= 60);\n  if (low.length < 2) continue;\n  const lines = low.slice(0, 6).map((e) => '[' + e['im:rating'].label + ' star] ' + ((e.title && e.title.label) || '') + ': ' + String(e.content.label).replace(/\\s+/g, ' ').slice(0, 300));\n  const text = 'Recent 1-2 star App Store reviews for \"' + meta.app_name + '\" (' + meta.genre + ' category). ' + low.length + ' of ' + reviews.length + ' recent reviews are negative:\\n' + lines.join('\\n');\n  out.push({ json: { post_id: 'app:' + meta.app_id + ':' + month, source: 'appstore:' + meta.genre, title: 'Users complain about ' + meta.app_name + ' (' + meta.genre + ')', post_text: text.slice(0, 1500), url: 'https://apps.apple.com/us/app/id' + meta.app_id, upvotes: low.length, num_comments: reviews.length, posted_at: new Date().toISOString(), matched_query: 'low-rated App Store reviews' } });\n}\nout.sort((a, b) => b.json.upvotes - a.json.upvotes);\nreturn out.slice(0, 12);",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      },
      "alwaysOutputData": true
    },
    {
      "id": "c23703d7-89b7-4374-b772-8ea088e1f8de",
      "name": "Build Search Requests",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1540,
        0
      ],
      "parameters": {
        "jsCode": "// Official, free APIs only: Hacker News (Algolia), GitHub issue search, Stack Exchange\nconst now = Date.now();\nconst day = 86400000;\nconst hnSince = Math.floor((now - 7 * day) / 1000);\nconst seSince = Math.floor((now - 14 * day) / 1000);\nconst ghSince = new Date(now - 14 * day).toISOString().slice(0, 10);\n\nconst hn = [];\nconst gh = [];\nconst se = [];\n\nconst hnQueries = ['is there a tool', 'I wish there was', 'tired of manually', 'looking for software', 'is there an app', 'alternative to', 'what do you use for', 'frustrated with'];\nfor (const q of hnQueries) {\n  hn.push({ source: 'hackernews', query: q, url: 'https://hn.algolia.com/api/v1/search?tags=ask_hn&hitsPerPage=25&numericFilters=' + encodeURIComponent('created_at_i>' + hnSince) + '&query=' + encodeURIComponent(q) });\n}\n\nconst ghQueries = ['\"is there a way to\"', '\"I wish there was\"', '\"would be nice if\"', '\"I have to manually\"', '\"would love to\"', '\"any way to\"', '\"there should be a way\"', '\"missing feature\"'];\nfor (const q of ghQueries) {\n  const full = q + ' is:issue is:open comments:>2 created:>=' + ghSince;\n  gh.push({ source: 'github', query: q, url: 'https://api.github.com/search/issues?per_page=15&sort=reactions&order=desc&q=' + encodeURIComponent(full) });\n}\n\nconst seTargets = [\n  { site: 'softwarerecs', q: '' },\n  { site: 'webapps', q: 'is there a way to' },\n  { site: 'superuser', q: 'is there a tool to automate' },\n  { site: 'apple', q: 'is there an app' },\n  { site: 'android', q: 'is there an app' },\n  { site: 'workplace', q: 'is there a tool' },\n  { site: 'money', q: 'is there a tool' },\n  { site: 'pm', q: 'is there a tool' },\n  { site: 'photo', q: 'is there a tool' },\n  { site: 'graphicdesign', q: 'is there a tool' }\n];\nfor (const t of seTargets) {\n  const base = 'https://api.stackexchange.com/2.3/';\n  const common = 'order=desc&site=' + t.site + '&pagesize=30&filter=withbody&fromdate=' + seSince;\n  const url = t.q ? base + 'search/advanced?sort=votes&' + common + '&q=' + encodeURIComponent(t.q) : base + 'questions?sort=creation&' + common;\n  se.push({ source: 'stackexchange', site: t.site, query: t.q || 'latest software recommendation requests', url: url });\n}\n\nconst out = [];\nlet idx = 0;\nlet added = true;\nwhile (added) {\n  added = false;\n  for (const arr of [hn, gh, se]) {\n    if (arr[idx]) { out.push({ json: arr[idx] }); added = true; }\n  }\n  idx++;\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "2d7c3876-07b9-4bf3-8f5f-15b750110c27",
      "name": "Fetch Sources",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        1760,
        0
      ],
      "parameters": {
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "problem-radar-n8n/1.0"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "method": "GET",
        "options": {
          "batching": {
            "batch": {
              "batchInterval": 1500,
              "batchSize": 4
            }
          },
          "timeout": 20000
        },
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "url": "={{ $json.url }}"
      },
      "onError": "continueRegularOutput"
    },
    {
      "id": "b0c9c57a-b469-4fa8-9cf4-dcd0d363efd8",
      "name": "Normalize Posts",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1980,
        0
      ],
      "parameters": {
        "jsCode": "// Turn every API response into one common post shape, dedupe, and interleave sources\nconst reqs = $('Build Search Requests').all();\nconst resp = $input.all();\nconst out = [];\nconst seen = {};\nconst strip = (s) => String(s || '').replace(/<[^>]*>/g, ' ').replace(/&quot;/g, '\"').replace(/&#39;/g, \"'\").replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/\\s+/g, ' ').trim();\n\nfor (let i = 0; i < resp.length; i++) {\n  const r = resp[i].json || {};\n  const meta = (reqs[i] && reqs[i].json) || {};\n  if (meta.source === 'hackernews') {\n    for (const h of (r.hits || [])) {\n      out.push({ post_id: 'hn:' + h.objectID, source: 'hackernews', title: h.title || '', post_text: strip(h.story_text), url: 'https://news.ycombinator.com/item?id=' + h.objectID, upvotes: h.points || 0, num_comments: h.num_comments || 0, posted_at: h.created_at, matched_query: meta.query });\n    }\n  } else if (meta.source === 'github') {\n    for (const h of (r.items || [])) {\n      out.push({ post_id: 'gh:' + h.id, source: 'github', title: h.title || '', post_text: strip(h.body), url: h.html_url, upvotes: (h.reactions && h.reactions.total_count) || 0, num_comments: h.comments || 0, posted_at: h.created_at, matched_query: meta.query });\n    }\n  } else if (meta.source === 'stackexchange') {\n    for (const q of (r.items || [])) {\n      out.push({ post_id: 'se:' + meta.site + ':' + q.question_id, source: 'stackexchange:' + meta.site, title: strip(q.title), post_text: strip(q.body), url: q.link, upvotes: q.score || 0, num_comments: q.answer_count || 0, posted_at: new Date((q.creation_date || 0) * 1000).toISOString(), matched_query: meta.query });\n    }\n  }\n}\n\nlet appstore = [];\ntry { appstore = $('Normalize Reviews').all().map((x) => x.json).filter((j) => j && j.post_id); } catch (e) { appstore = []; }\nconst buckets = { appstore: appstore, hackernews: [], github: [], stackexchange: [] };\nfor (const p of appstore) { seen[p.post_id] = true; }\n\nfor (const p of out) {\n  if (!p.title || seen[p.post_id]) continue;\n  const fam = p.source.split(':')[0];\n  if ((fam === 'hackernews' || fam === 'github') && (p.upvotes + p.num_comments) < 2) continue;\n  if (!buckets[fam]) continue;\n  seen[p.post_id] = true;\n  p.post_text = p.post_text.slice(0, 1500);\n  buckets[fam].push(p);\n}\n\nconst score = (p) => (p.upvotes || 0) + (p.num_comments || 0) * 2;\nfor (const k of ['hackernews', 'github', 'stackexchange']) {\n  buckets[k].sort((a, b) => score(b) - score(a));\n}\n\nconst order = ['appstore', 'hackernews', 'github', 'stackexchange'];\nconst result = [];\nlet added = true;\nwhile (result.length < 150 && added) {\n  added = false;\n  for (const k of order) {\n    const next = buckets[k].shift();\n    if (next) { result.push(next); added = true; }\n  }\n}\nreturn result.map((p) => ({ json: p }));",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "e2eab900-890c-4c7a-a067-d2e7faca1151",
      "name": "Skip Seen Posts",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        0,
        300
      ],
      "parameters": {
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_DATA_TABLE_ID"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "post_id",
              "keyValue": "={{ $json.post_id }}"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "rowNotExists",
        "resource": "row"
      }
    },
    {
      "id": "ee6f974e-623f-4734-8754-c4bd7f08e4f7",
      "name": "Cap Triage Batch",
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        220,
        300
      ],
      "parameters": {
        "keep": "firstItems",
        "maxItems": 40
      }
    },
    {
      "id": "73588a6b-c7e5-4e79-a5fd-97ea0ba02ef9",
      "name": "AI Triage Post",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1.2,
      "position": [
        440,
        300
      ],
      "parameters": {
        "attributes": {
          "attributes": [
            {
              "description": "True only if the author describes a concrete problem or unmet need that a software product or tool could address. False for news, opinions, job posts, showcase posts, homework, and bug reports about one specific library.",
              "name": "is_real_problem",
              "required": true,
              "type": "boolean"
            },
            {
              "description": "Integer 0-10. 8-10 = recurring daily or weekly pain with a tedious manual workaround. 4-7 = real annoyance with friction. 0-3 = mild curiosity or a one-off question.",
              "name": "pain_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "The specific audience that has this problem (for example \"freelance accountants\" or \"Discord server admins\"). Say \"unclear\" if the text does not show it.",
              "name": "who_has_problem",
              "required": true,
              "type": "string"
            },
            {
              "description": "The core problem in one sentence.",
              "name": "summary",
              "required": true,
              "type": "string"
            },
            {
              "description": "How people cope today: spreadsheets, Notion pages, scripts, copy-paste between apps, manual repetition. Empty string if none is mentioned.",
              "name": "workaround",
              "type": "string"
            },
            {
              "description": "Evidence someone would pay: paid tools named, business or time cost, asking for paid recommendations. Empty string if none.",
              "name": "wtp_signals",
              "type": "string"
            },
            {
              "description": "Integer 0-10. How realistic it is for ONE developer to ship a useful software-only MVP in 2-6 weeks with no license fees, special hardware, regulatory approval, or large data and network effects. 10 = trivial, 0 = impossible.",
              "name": "buildable_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "One sentence describing the smallest app or tool that would solve this for this audience.",
              "name": "app_angle",
              "required": true,
              "type": "string"
            },
            {
              "description": "A 3-8 word web search query that would find existing tools or apps that already solve this problem.",
              "name": "competitor_search_query",
              "required": true,
              "type": "string"
            }
          ]
        },
        "options": {
          "batching": {
            "batchSize": 1,
            "delayBetweenBatches": 0
          },
          "systemPromptTemplate": "You screen online posts for software product opportunities. Use this filter: Is there a real problem? Is it painful enough that someone might pay to fix it? Are people already working around it (spreadsheets, copy-paste, scripts, manual repetition)? Could one developer build a small version? Judge only from the provided text and never invent facts. Be strict: most posts are not product opportunities."
        },
        "schemaType": "fromAttributes",
        "text": "=Source: {{ $json.source }}\nTitle: {{ $json.title }}\nScore: {{ $json.upvotes }}, Comments/answers: {{ $json.num_comments }}\nFound via query: {{ $json.matched_query }}\n\nBody:\n{{ $json.post_text }}"
      },
      "onError": "continueRegularOutput",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 2000
    },
    {
      "id": "c59d54b6-6f68-4be9-89fc-bc95e13eedcd",
      "name": "Triage Model (local)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        520,
        520
      ],
      "parameters": {
        "model": "={{ $('Config').first().json.triage_model }}",
        "options": {
          "numCtx": "={{ $('Config').first().json.num_ctx }}",
          "temperature": 0.1,
          "think": false
        }
      }
    },
    {
      "id": "144aad90-4cda-4935-8ccd-cb70564f8f58",
      "name": "Merge Triage Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        660,
        300
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "m1",
              "name": "post_id",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.post_id }}"
            },
            {
              "id": "m2",
              "name": "title",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.title }}"
            },
            {
              "id": "m3",
              "name": "url",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.url }}"
            },
            {
              "id": "m4",
              "name": "source",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.source }}"
            },
            {
              "id": "m5",
              "name": "upvotes",
              "type": "number",
              "value": "={{ $('Cap Triage Batch').item.json.upvotes }}"
            },
            {
              "id": "m6",
              "name": "num_comments",
              "type": "number",
              "value": "={{ $('Cap Triage Batch').item.json.num_comments }}"
            },
            {
              "id": "m7",
              "name": "posted_at",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.posted_at }}"
            },
            {
              "id": "m8",
              "name": "post_text",
              "type": "string",
              "value": "={{ $('Cap Triage Batch').item.json.post_text }}"
            },
            {
              "id": "m9",
              "name": "is_real_problem",
              "type": "boolean",
              "value": "={{ $json.output?.is_real_problem === true || $json.output?.is_real_problem === 'true' }}"
            },
            {
              "id": "m10",
              "name": "pain_score",
              "type": "number",
              "value": "={{ Number.isFinite(Number($json.output?.pain_score)) ? Math.max(0, Math.min(10, Math.round(Number($json.output.pain_score)))) : -1 }}"
            },
            {
              "id": "m11",
              "name": "buildable_score",
              "type": "number",
              "value": "={{ Number.isFinite(Number($json.output?.buildable_score)) ? Math.max(0, Math.min(10, Math.round(Number($json.output.buildable_score)))) : 0 }}"
            },
            {
              "id": "m12",
              "name": "who_has_problem",
              "type": "string",
              "value": "={{ $json.output?.who_has_problem || \"\" }}"
            },
            {
              "id": "m13",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.output?.summary || \"\" }}"
            },
            {
              "id": "m14",
              "name": "workaround",
              "type": "string",
              "value": "={{ $json.output?.workaround || \"\" }}"
            },
            {
              "id": "m15",
              "name": "wtp_signals",
              "type": "string",
              "value": "={{ /^(none|no\\b|n\\/a|not\\b|empty|unclear)/i.test(String($json.output?.wtp_signals || '').trim()) ? '' : ($json.output?.wtp_signals || '') }}"
            },
            {
              "id": "m16",
              "name": "app_angle",
              "type": "string",
              "value": "={{ $json.output?.app_angle || \"\" }}"
            },
            {
              "id": "m17",
              "name": "competitor_search_query",
              "type": "string",
              "value": "={{ $json.output?.competitor_search_query || $('Cap Triage Batch').item.json.title }}"
            },
            {
              "id": "m18",
              "name": "triage_rank",
              "type": "number",
              "value": "={{ (Number($json.output?.pain_score) || 0) + (Number($json.output?.buildable_score) || 0) + ((String($json.output?.wtp_signals || '').trim().length > 10 && !/^(none|no\\b|n\\/a|not\\b|empty|unclear)/i.test(String($json.output?.wtp_signals || '').trim())) ? 2 : 0) }}"
            }
          ]
        },
        "mode": "manual",
        "options": {}
      }
    },
    {
      "id": "be625de9-71dc-4d43-92dd-0c08ef40d505",
      "name": "Triage Succeeded",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        880,
        300
      ],
      "parameters": {
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.pain_score }}",
              "operator": {
                "operation": "gte",
                "type": "number"
              },
              "rightValue": 0
            }
          ],
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          }
        },
        "options": {}
      }
    },
    {
      "id": "b3bac63e-438a-4a5d-9b6d-e5fca1892d24",
      "name": "Worth a Deeper Look?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1100,
        300
      ],
      "parameters": {
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.is_real_problem }}",
              "operator": {
                "operation": "true",
                "singleValue": true,
                "type": "boolean"
              }
            },
            {
              "leftValue": "={{ $json.pain_score }}",
              "operator": {
                "operation": "gte",
                "type": "number"
              },
              "rightValue": 4
            },
            {
              "leftValue": "={{ $json.buildable_score }}",
              "operator": {
                "operation": "gte",
                "type": "number"
              },
              "rightValue": 4
            }
          ],
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          }
        },
        "options": {}
      }
    },
    {
      "id": "21f6dcbc-e9e7-46f4-82a3-2d0f8a2e6e7e",
      "name": "Save Skipped Posts",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        1320,
        480
      ],
      "parameters": {
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "app_angle": "={{ $json.app_angle }}",
            "buildable_score": "={{ $json.buildable_score }}",
            "num_comments": "={{ $json.num_comments }}",
            "pain_score": "={{ $json.pain_score }}",
            "post_id": "={{ $json.post_id }}",
            "posted_at": "={{ $json.posted_at }}",
            "run_model": "={{ $('Config').first().json.triage_model }}",
            "source": "={{ $json.source }}",
            "status": "skipped",
            "summary": "={{ $json.summary }}",
            "title": "={{ $json.title }}",
            "upvotes": "={{ $json.upvotes }}",
            "url": "={{ $json.url }}",
            "who_has_problem": "={{ $json.who_has_problem }}",
            "workaround": "={{ $json.workaround }}",
            "wtp_signals": "={{ $json.wtp_signals }}"
          }
        },
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_DATA_TABLE_ID"
        },
        "operation": "insert",
        "resource": "row"
      }
    },
    {
      "id": "43123264-4a17-4dbe-9e11-fdf48b6c085d",
      "name": "Rank Shortlist",
      "type": "n8n-nodes-base.sort",
      "typeVersion": 1,
      "position": [
        0,
        700
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "triage_rank",
              "order": "descending"
            }
          ]
        },
        "type": "simple"
      }
    },
    {
      "id": "1b1744ca-3c88-4a5e-9e1d-b35f317e2396",
      "name": "Keep Top 8",
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        220,
        700
      ],
      "parameters": {
        "keep": "firstItems",
        "maxItems": 8
      }
    },
    {
      "id": "2253283b-b298-470e-bf73-89a661807f95",
      "name": "Search Competitors (SearXNG)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        440,
        700
      ],
      "parameters": {
        "method": "GET",
        "options": {
          "batching": {
            "batch": {
              "batchInterval": 6000,
              "batchSize": 1
            }
          },
          "timeout": 25000
        },
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.competitor_search_query }}"
            },
            {
              "name": "format",
              "value": "json"
            },
            {
              "name": "language",
              "value": "en"
            }
          ]
        },
        "sendQuery": true,
        "specifyQuery": "keypair",
        "url": "={{ $('Config').first().json.searxng_url }}/search"
      },
      "onError": "continueRegularOutput"
    },
    {
      "id": "a7318144-d819-414b-942a-0670609d1548",
      "name": "Add Competitor Context",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        660,
        700
      ],
      "parameters": {
        "jsonOutput": "={{ { ...$('Keep Top 8').item.json, competitor_context: (($json.results || []).slice(0, 6).map(r => '- ' + r.title + ' (' + r.url + '): ' + String(r.content || '').slice(0, 220)).join('\\n')) || 'No search results were returned. Competitors must be verified manually.' } }}",
        "mode": "raw",
        "options": {}
      }
    },
    {
      "id": "a501ffb7-4749-4313-be38-a005af1b9b4c",
      "name": "Search Open Source (SearXNG)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        880,
        700
      ],
      "parameters": {
        "method": "GET",
        "options": {
          "batching": {
            "batch": {
              "batchInterval": 6000,
              "batchSize": 1
            }
          },
          "timeout": 25000
        },
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.competitor_search_query }} open source github self-hosted"
            },
            {
              "name": "format",
              "value": "json"
            },
            {
              "name": "language",
              "value": "en"
            }
          ]
        },
        "sendQuery": true,
        "specifyQuery": "keypair",
        "url": "={{ $('Config').first().json.searxng_url }}/search"
      },
      "onError": "continueRegularOutput"
    },
    {
      "id": "fe682ac1-c665-4947-9687-ae5215cd8db8",
      "name": "Add Open Source Context",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1100,
        700
      ],
      "parameters": {
        "jsonOutput": "={{ { ...$('Add Competitor Context').item.json, oss_context: (($json.results || []).slice(0, 6).map(r => '- ' + r.title + ' (' + r.url + '): ' + String(r.content || '').slice(0, 220)).join('\\n')) || 'No open-source search results were returned. Check GitHub manually.' } }}",
        "mode": "raw",
        "options": {}
      }
    },
    {
      "id": "023af467-4715-4558-9b40-5a213ca5a59b",
      "name": "AI Score Opportunity",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1.2,
      "position": [
        0,
        1000
      ],
      "parameters": {
        "attributes": {
          "attributes": [
            {
              "description": "One-sentence pitch: \"[Product] helps [audience] do [outcome] without [pain]\".",
              "name": "one_liner",
              "required": true,
              "type": "string"
            },
            {
              "description": "Exactly one of: none found, low, medium, high.",
              "name": "competition_level",
              "required": true,
              "type": "string"
            },
            {
              "description": "Products named in the search results, one per line as \"Name - what it does - price if known\". Only names that appear in the search results. If none, write \"None identified in search results\".",
              "name": "competitors",
              "required": true,
              "type": "string"
            },
            {
              "description": "The closest free or open-source project named in the search results, as \"Name - how much of the MVP it covers\". If none, write \"None found in search results\".",
              "name": "closest_open_source",
              "required": true,
              "type": "string"
            },
            {
              "description": "Integer 0-10. 10 = nothing in the results solves this; 5 = tools exist but miss a clear niche; 0-3 = an existing product or open-source project already covers most of it.",
              "name": "competition_gap_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "Integer 0-10. 0-3 = audience expects free or no payment evidence; 4-6 = adjacent paid products exist; 7-10 = people in the post already pay or offer to pay.",
              "name": "wtp_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "Integer 0-10. 8-10 = recurring daily or weekly pain with a tedious workaround; 4-7 = real annoyance; 0-3 = mild or one-off.",
              "name": "pain_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "Integer 0-10. How realistic it is for this builder to ship an MVP in 2-6 weeks of spare time with no license fees.",
              "name": "buildable_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "Integer 0-10. 10 = buyers can find it in a marketplace or community; 0 = only cold outreach would work.",
              "name": "reachability_score",
              "required": true,
              "type": "number"
            },
            {
              "description": "One sentence explaining the most important factor behind these scores.",
              "name": "score_reason",
              "required": true,
              "type": "string"
            }
          ]
        },
        "options": {
          "batching": {
            "batchSize": 1,
            "delayBetweenBatches": 0
          },
          "systemPromptTemplate": "={{ $('Config').first().json.scoring_rules }}\n\nBUILDER PROFILE: {{ $('Config').first().json.builder_profile }}"
        },
        "schemaType": "fromAttributes",
        "text": "=PROBLEM SOURCE: {{ $json.source }} - {{ $json.url }}\nTITLE: {{ $json.title }}\nSUMMARY: {{ $json.summary }}\nAUDIENCE: {{ $json.who_has_problem }}\nWORKAROUND: {{ $json.workaround }}\nWILLINGNESS TO PAY SIGNALS: {{ $json.wtp_signals || 'none found' }}\nSMALLEST APP ANGLE: {{ $json.app_angle }}\n\nORIGINAL POST:\n{{ $json.post_text }}\n\nWEB SEARCH RESULTS FOR EXISTING PRODUCTS:\n{{ $json.competitor_context }}\n\nWEB SEARCH RESULTS FOR OPEN-SOURCE / FREE PROJECTS:\n{{ $json.oss_context }}"
      },
      "onError": "continueRegularOutput",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 2000
    },
    {
      "id": "d0223f6c-e17d-42dd-929b-17ed3eda400a",
      "name": "Score Model (local)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        80,
        1220
      ],
      "parameters": {
        "model": "={{ $('Config').first().json.analysis_model }}",
        "options": {
          "numCtx": "={{ $('Config').first().json.num_ctx }}",
          "temperature": 0.1,
          "think": false
        }
      }
    },
    {
      "id": "6fb3b542-650f-42d0-9d53-b16b70fdaa3c",
      "name": "Merge Score Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        220,
        1000
      ],
      "parameters": {
        "jsonOutput": "={{ { ...$('Add Open Source Context').item.json, triage_pain_score: $('Add Open Source Context').item.json.pain_score, ...($json.output || {}) } }}",
        "mode": "raw",
        "options": {}
      }
    },
    {
      "id": "9fd6dd40-ff93-4551-8b50-57992ad2e01b",
      "name": "Validate & Retry Scores",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        1000
      ],
      "parameters": {
        "jsCode": "// CHECK 1 - Small local models often break structured output: a score of \"high\" instead of 7,\n// a competition level that isn't one of the four allowed values, or an empty field.\n// Every scored idea is checked here. If it fails, we ask ONE more time through Ollama's own API\n// with a JSON schema in `format` (Ollama constrains the output to that schema) and we tell the\n// model exactly what was wrong. If it still fails, the idea is marked invalid and dropped later.\nconst cfg = $('Config').first().json;\nconst LEVELS = ['none found', 'low', 'medium', 'high'];\nconst NUMS = ['competition_gap_score', 'wtp_score', 'pain_score', 'buildable_score', 'reachability_score'];\nconst TEXTS = ['one_liner', 'competitors', 'closest_open_source', 'score_reason'];\nconst intField = { type: 'integer', minimum: 0, maximum: 10 };\nconst schema = {\n  type: 'object',\n  properties: {\n    one_liner: { type: 'string' }, competition_level: { type: 'string', enum: LEVELS },\n    competitors: { type: 'string' }, closest_open_source: { type: 'string' },\n    competition_gap_score: intField, wtp_score: intField, pain_score: intField,\n    buildable_score: intField, reachability_score: intField, score_reason: { type: 'string' }\n  },\n  required: TEXTS.concat(NUMS, ['competition_level'])\n};\nconst system = cfg.scoring_rules + '\\n\\nBUILDER PROFILE: ' + cfg.builder_profile;\n\nconst normalize = (o) => {\n  o.competition_level = String(o.competition_level ?? '').toLowerCase().trim();\n  for (const k of NUMS) { const n = Number(o[k]); if (Number.isFinite(n)) o[k] = n; }\n  return o;\n};\nconst check = (o) => {\n  const errs = [];\n  for (const k of TEXTS) if (!String(o[k] ?? '').trim()) errs.push(k + ' is empty');\n  if (!LEVELS.includes(o.competition_level)) errs.push('competition_level must be one of: ' + LEVELS.join(', ') + ' (got \"' + o.competition_level + '\")');\n  for (const k of NUMS) {\n    const n = o[k];\n    if (typeof n !== 'number' || !Number.isInteger(n) || n < 0 || n > 10) errs.push(k + ' must be a whole number from 0 to 10 (got \"' + n + '\")');\n  }\n  return errs;\n};\nconst parseJson = (s) => {\n  const t = String(s || '');\n  try { return JSON.parse(t); } catch (e) {\n    const m = t.match(/\\{[\\s\\S]*\\}/);\n    if (m) return JSON.parse(m[0]);\n    throw e;\n  }\n};\nconst promptFor = (j) => 'PROBLEM SOURCE: ' + j.source + ' - ' + j.url + '\\nTITLE: ' + j.title + '\\nSUMMARY: ' + j.summary + '\\nAUDIENCE: ' + j.who_has_problem + '\\nWORKAROUND: ' + j.workaround + '\\nWILLINGNESS TO PAY SIGNALS: ' + (j.wtp_signals || 'none found') + '\\nSMALLEST APP ANGLE: ' + j.app_angle + '\\n\\nORIGINAL POST:\\n' + j.post_text + '\\n\\nWEB SEARCH RESULTS FOR EXISTING PRODUCTS:\\n' + j.competitor_context + '\\n\\nWEB SEARCH RESULTS FOR OPEN-SOURCE / FREE PROJECTS:\\n' + j.oss_context;\n\nconst items = $input.all();\nconst out = [];\nfor (let idx = 0; idx < items.length; idx++) {\n  const j = normalize({ ...items[idx].json });\n  let errs = check(j);\n  j.retried = false;\n  j.first_errors = errs.join('; ');\n  if (errs.length) {\n    j.retried = true;\n    try {\n      const res = await this.helpers.httpRequest({\n        method: 'POST',\n        url: cfg.ollama_url + '/api/chat',\n        json: true,\n        timeout: 600000,\n        body: {\n          model: cfg.analysis_model,\n          stream: false,\n          think: false,\n          format: schema,\n          options: { temperature: 0, num_ctx: Number(cfg.num_ctx) || 8192 },\n          messages: [\n            { role: 'system', content: system },\n            { role: 'user', content: promptFor(j) + '\\n\\nYour previous answer had these problems. Fix them and answer again as JSON:\\n- ' + errs.join('\\n- ') }\n          ]\n        }\n      });\n      Object.assign(j, parseJson(res && res.message && res.message.content));\n      normalize(j);\n      errs = check(j);\n    } catch (e) {\n      errs.push('retry call failed: ' + e.message);\n    }\n  }\n  j.analysis_ok = errs.length === 0;\n  j.validation_errors = errs.join('; ');\n  out.push({ json: j, pairedItem: { item: idx } });\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "58571cf1-ff2f-4034-972d-ecc1acab4df7",
      "name": "Ground Competitor Names",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        1000
      ],
      "parameters": {
        "jsCode": "// CHECK 2 - Small models invent products. Every competitor or open-source project the model\n// named must actually appear in the SearXNG results it was given, or in the post itself (so the\n// app people are complaining about is not mistaken for an invented one). Names that don't are\n// removed and recorded, so the report can say how many were made up. No AI - plain text matching.\nconst nameOf = (line) => line.replace(/^[-*\\d.\\s]+/, '').split(/\\s[-–—:]\\s|\\s\\(/)[0].trim();\nconst items = $input.all();\nconst out = [];\nfor (let idx = 0; idx < items.length; idx++) {\n  const j = { ...items[idx].json };\n  const hay = [j.competitor_context, j.oss_context, j.title, j.post_text].map((s) => String(s || '')).join('\\n').toLowerCase();\n  const removed = [];\n  const keep = [];\n  for (const line of String(j.competitors || '').split('\\n')) {\n    const t = line.trim();\n    if (!t) continue;\n    if (/^none/i.test(t)) { keep.push(t); continue; }\n    const name = nameOf(t);\n    if (name.length < 2 || hay.includes(name.toLowerCase())) keep.push(t); else removed.push(name);\n  }\n  j.competitors = keep.length ? keep.join('\\n') : 'None verified in search results - check manually';\n  const oss = String(j.closest_open_source || '').trim();\n  if (oss && !/^none/i.test(oss)) {\n    const n = nameOf(oss);\n    if (n.length >= 2 && !hay.includes(n.toLowerCase())) {\n      removed.push(n);\n      j.closest_open_source = 'None verified in search results - check GitHub manually';\n    }\n  }\n  j.removed_names = removed.join(', ');\n  out.push({ json: j, pairedItem: { item: idx } });\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "7cccf6e4-b0aa-45a5-a695-750409ff2e34",
      "name": "Compute Score & Flags",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        1000
      ],
      "parameters": {
        "jsCode": "// The overall score is computed here, not by the model.\n// Weights: pain 25, willingness to pay 25, competition gap 20, buildable 20, reachability 10.\n// CHECK 3 - contradiction flags: answers that don't agree with each other lower the confidence,\n// and a low-confidence idea never gets a full write-up even if its score is high.\nconst cfg = $('Config').first().json;\nconst minScore = Number(cfg.min_opportunity_score) || 60;\nconst clamp = (v) => { const n = Number(v); return Number.isFinite(n) ? Math.max(0, Math.min(10, Math.round(n))) : 0; };\nconst items = $input.all();\nconst out = [];\nfor (let idx = 0; idx < items.length; idx++) {\n  const j = items[idx].json;\n  const ok = j.analysis_ok === true && !!String(j.one_liner || '').trim();\n  const pain = clamp(j.pain_score), wtp = clamp(j.wtp_score), gap = clamp(j.competition_gap_score), build = clamp(j.buildable_score), reach = clamp(j.reachability_score);\n  let score = Math.round(pain * 2.5 + wtp * 2.5 + gap * 2 + build * 2 + reach);\n  const caps = [];\n  const level = String(j.competition_level || '').toLowerCase().trim();\n  if (wtp < 4 && score > 50) { score = 50; caps.push('capped at 50: willingness to pay under 4'); }\n  if (level === 'high' && gap < 6 && score > 50) { score = 50; caps.push('capped at 50: high competition without a clear gap'); }\n\n  const flags = [];\n  if (level === 'high' && gap >= 7) flags.push('competition marked high but gap scored ' + gap);\n  if ((level === 'none found' || level === 'low') && gap <= 3) flags.push('competition marked ' + level + ' but gap scored ' + gap);\n  const tp = Number(j.triage_pain_score);\n  if (Number.isFinite(tp) && Math.abs(tp - pain) >= 4) flags.push('triage pain ' + tp + ' vs analysis pain ' + pain);\n  if (wtp >= 7 && !String(j.wtp_signals || '').trim()) flags.push('pay score ' + wtp + ' with no payment evidence in the post');\n  if (j.removed_names) flags.push('removed unverified names: ' + j.removed_names);\n  if (j.retried) flags.push('needed a retry');\n  const confidence = flags.length >= 2 ? 'low' : (flags.length === 1 ? 'medium' : 'high');\n\n  const factors = { pain: pain, 'willingness to pay': wtp, 'competition gap': gap, buildable: build, reachability: reach };\n  const weakest = Object.keys(factors).sort((a, b) => factors[a] - factors[b])[0];\n  out.push({ json: { ...j, pain_score: pain, wtp_score: wtp, competition_gap_score: gap, buildable_score: build, reachability_score: reach,\n    opportunity_score: ok ? Math.max(score, 1) : 0, score_caps: caps.join('; '), weakest_factor: weakest + ' ' + factors[weakest] + '/10',\n    confidence: confidence, confidence_flags: flags.join('; '), is_strong: ok && score >= minScore && confidence !== 'low' }, pairedItem: { item: idx } });\n}\nreturn out;",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "2cc2e5f1-49ed-41ce-8894-e6855f012586",
      "name": "Analysis Succeeded",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        1100,
        1000
      ],
      "parameters": {
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "leftValue": "={{ $json.opportunity_score }}",
              "operator": {
                "operation": "gt",
                "type": "number"
              },
              "rightValue": 0
            }
          ],
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          }
        },
        "options": {}
      }
    },
    {
      "id": "76db71bd-64da-4120-85ee-cbeac6d9713e",
      "name": "Rank by Opportunity",
      "type": "n8n-nodes-base.sort",
      "typeVersion": 1,
      "position": [
        1320,
        1000
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "opportunity_score",
              "order": "descending"
            }
          ]
        },
        "type": "simple"
      }
    },
    {
      "id": "e74872c0-499a-4a49-8626-4c19262eec62",
      "name": "Keep Top 5",
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        1540,
        1000
      ],
      "parameters": {
        "keep": "firstItems",
        "maxItems": 5
      }
    },
    {
      "id": "dc6e52a3-7807-4fae-9e75-54b1c180c341",
      "name": "Plan Strong Ideas",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        1400
      ],
      "parameters": {
        "jsCode": "// The full MVP write-up only runs for ideas that cleared the bar, and it is split into two small\n// requests (product plan, then go-to-market) because small models get worse as you ask for more\n// fields at once. Both use Ollama's JSON-schema `format`, so the answer is always valid JSON.\n// Runs once per idea, so each idea gets its own time budget (one task for all ideas hit n8n's 300 s limit).\nconst cfg = $('Config').first().json;\nconst system = 'You are a senior software architect and startup advisor helping ONE solo developer plan a small product. Be concrete and honest. Use only facts from the material given; never invent product names or prices.\\n\\nBUILDER PROFILE: ' + cfg.builder_profile;\nconst PLAN = [\n  { name: 'differentiator', desc: 'The wedge: how a solo developer could be meaningfully different or better for a specific niche.' },\n  { name: 'mvp_scope', desc: '3-6 must-have MVP features as lines starting with \"- \", then one line starting with \"NOT in MVP:\".' },\n  { name: 'architecture', desc: 'Components, data flow, storage, where it runs (self-hosted Docker, free tier, browser extension) and how users sign in and pay, as short \"- \" lines.' },\n  { name: 'recommended_stack', desc: 'Specific technologies and why, preferring the builder\\'s existing skills and free tooling.' },\n  { name: 'skills_you_have', desc: 'Which parts of the build match the builder\\'s existing skills.' },\n  { name: 'skills_to_learn', desc: 'New skills needed, one per line as \"- Skill: why, rough time to learn\", or \"None\".' },\n  { name: 'build_estimate', desc: 'Rough focused hours for the MVP and the single biggest uncertainty.' }\n];\nconst GTM = [\n  { name: 'competitor_gaps', desc: 'What the existing tools miss or do badly, based only on the competitors and search results given.' },\n  { name: 'wtp_assessment', desc: 'Evidence for and against people paying, and a realistic price point.' },\n  { name: 'monetization', desc: 'How to charge (subscription, one-time, usage) and a first price to test.' },\n  { name: 'first_validation_step', desc: 'The cheapest way to test real demand before building: where these people gather and what to ask or offer.' },\n  { name: 'risks', desc: 'The top 2-3 reasons this could fail.' }\n];\nconst asText = (v) => Array.isArray(v) ? v.map((x) => '- ' + (typeof x === 'string' ? x : JSON.stringify(x))).join('\\n') : (typeof v === 'object' && v !== null ? JSON.stringify(v) : String(v ?? ''));\nconst parseJson = (s) => {\n  const t = String(s || '');\n  try { return JSON.parse(t); } catch (e) {\n    const m = t.match(/\\{[\\s\\S]*\\}/);\n    if (m) return JSON.parse(m[0]);\n    throw e;\n  }\n};\nconst context = (j) => 'IDEA: ' + j.one_liner + '\\nPROBLEM: ' + j.summary + '\\nAUDIENCE: ' + j.who_has_problem + '\\nWORKAROUND: ' + (j.workaround || 'none mentioned') + '\\nPAYMENT SIGNALS: ' + (j.wtp_signals || 'none found') + '\\nCOMPETITORS (verified): ' + j.competitors + '\\nCLOSEST OPEN SOURCE: ' + j.closest_open_source + '\\nSCORES: pain ' + j.pain_score + ', pay ' + j.wtp_score + ', gap ' + j.competition_gap_score + ', buildable ' + j.buildable_score + ', reach ' + j.reachability_score + '\\n\\nORIGINAL POST:\\n' + j.post_text + '\\n\\nSEARCH RESULTS - PRODUCTS:\\n' + j.competitor_context + '\\n\\nSEARCH RESULTS - OPEN SOURCE:\\n' + j.oss_context;\nconst ask = async (fields, task, j) => {\n  const props = {};\n  for (const f of fields) props[f.name] = { type: 'string' };\n  const res = await this.helpers.httpRequest({\n    method: 'POST',\n    url: cfg.ollama_url + '/api/chat',\n    json: true,\n    timeout: 900000,\n    body: {\n      model: cfg.analysis_model,\n      stream: false,\n      think: false,\n      format: { type: 'object', properties: props, required: fields.map((f) => f.name) },\n      options: { temperature: 0.3, num_ctx: Number(cfg.num_ctx) || 8192 },\n      messages: [\n        { role: 'system', content: system },\n        { role: 'user', content: task + '\\n\\n' + context(j) + '\\n\\nAnswer as JSON with these fields:\\n' + fields.map((f) => '- ' + f.name + ': ' + f.desc).join('\\n') }\n      ]\n    }\n  });\n  const parsed = parseJson(res && res.message && res.message.content);\n  const outObj = {};\n  for (const f of fields) outObj[f.name] = asText(parsed[f.name]);\n  return outObj;\n};\n\nconst j = { ...$json };\nif (j.is_strong) {\n  try {\n    Object.assign(j, await ask(PLAN, 'Design the smallest useful MVP for this idea.', j));\n    Object.assign(j, await ask(GTM, 'Assess the market for this idea and how to test demand cheaply.', j));\n  } catch (e) {\n    j.plan_error = e.message;\n  }\n}\nreturn { json: j };",
        "language": "javaScript",
        "mode": "runOnceForEachItem"
      }
    },
    {
      "id": "329c27fb-a677-44c4-9efe-a90fc63180f4",
      "name": "Collect Top Ideas",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        220,
        1400
      ],
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "ideas",
        "include": "allFields",
        "options": {}
      }
    },
    {
      "id": "4f18bc2b-9954-448a-bed5-36be02a6478b",
      "name": "Build Report",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        1400
      ],
      "parameters": {
        "jsCode": "// Builds the Google Doc text and the Discord message, plus a run summary so silent failures show up.\nconst cfg = $('Config').first().json;\nconst minScore = Number(cfg.min_opportunity_score) || 60;\nconst ideas = ($input.first().json.ideas || []).map((i) => ({ ...i, status: i.is_strong ? 'digested' : 'near_miss' }));\nconst strong = ideas.filter((i) => i.status === 'digested');\nconst near = ideas.filter((i) => i.status === 'near_miss');\nconst NL = String.fromCharCode(10);\nconst dateLabel = $now.toFormat('cccc, LLLL d, yyyy');\nconst dateIso = $now.toFormat('yyyy-LL-dd');\nconst cut = (s, n) => { const t = String(s || '').replace(/\\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };\nconst breakdown = (i) => 'Pain ' + i.pain_score + '/10 | Pay ' + i.wtp_score + '/10 | Gap ' + i.competition_gap_score + '/10 | Buildable ' + i.buildable_score + '/10 | Reach ' + i.reachability_score + '/10';\nconst whyNot = (i) => i.score_caps || (i.confidence === 'low' ? 'low confidence: ' + i.confidence_flags : 'weakest: ' + i.weakest_factor);\n\n// Run summary\nconst count = (n) => { try { return $(n).all().length; } catch (e) { return 0; } };\nconst rows = (n) => { try { return $(n).all().map((x) => x.json); } catch (e) { return []; } };\nconst validated = rows('Validate & Retry Scores');\nconst grounded = rows('Ground Competitor Names');\nconst triaged = count('Cap Triage Batch');\nconst stats = {\n  fetched: count('Normalize Posts'), fresh: count('Skip Seen Posts'), triaged: triaged, triage_failed: triaged - count('Triage Succeeded'),\n  shortlisted: count('Keep Top 8'), retried: validated.filter((v) => v.retried).length, dropped: validated.filter((v) => v.analysis_ok === false).length,\n  names_removed: grounded.reduce((n, g) => n + (g.removed_names ? String(g.removed_names).split(', ').length : 0), 0),\n  plan_errors: ideas.filter((i) => i.plan_error).length\n};\nconst statLine = 'Run: ' + stats.fetched + ' posts fetched, ' + stats.fresh + ' new, ' + stats.triaged + ' triaged (' + stats.triage_failed + ' failed), ' + stats.shortlisted + ' shortlisted, ' + stats.retried + ' scoring retries, ' + stats.dropped + ' dropped as invalid, ' + stats.names_removed + ' unverified names removed' + (stats.plan_errors ? ', ' + stats.plan_errors + ' plan errors' : '') + '. Models: triage ' + cfg.triage_model + ', analysis ' + cfg.analysis_model + '.';\n\nconst doc = [];\ndoc.push('PROBLEM RADAR (channel edition) - ' + dateLabel);\ndoc.push(strong.length ? strong.length + ' idea(s) cleared the bar (' + minScore + '+, not low confidence) today.' : 'No strong ideas today - nothing scored ' + minScore + '+ with enough confidence. Near misses are listed at the end.');\ndoc.push(statLine);\ndoc.push('');\nstrong.forEach((i, idx) => {\n  doc.push('==================================================');\n  doc.push('IDEA ' + (idx + 1) + ' - ' + i.one_liner);\n  doc.push('Opportunity score: ' + i.opportunity_score + '/100   Confidence: ' + i.confidence);\n  doc.push(breakdown(i));\n  if (i.score_caps) doc.push('Score caps: ' + i.score_caps);\n  if (i.confidence_flags) doc.push('Check flags: ' + i.confidence_flags);\n  doc.push('Why: ' + i.score_reason);\n  doc.push('Source: ' + i.source + ' - ' + i.url);\n  doc.push('==================================================');\n  doc.push('');\n  doc.push('THE PROBLEM');\n  doc.push(i.summary);\n  doc.push('Who has it: ' + i.who_has_problem);\n  doc.push('Current workaround: ' + (i.workaround || 'none mentioned'));\n  doc.push('');\n  if (i.plan_error) { doc.push('PLAN FAILED: ' + i.plan_error); doc.push(''); }\n  doc.push('WILL PEOPLE PAY?');\n  doc.push(i.wtp_assessment || '-');\n  doc.push('');\n  doc.push('COMPETITION (' + i.competition_level + ')');\n  doc.push(i.competitors);\n  doc.push('Closest open source: ' + i.closest_open_source);\n  doc.push('Gaps: ' + (i.competitor_gaps || '-'));\n  doc.push('Your wedge: ' + (i.differentiator || '-'));\n  doc.push('');\n  doc.push('MVP SCOPE');\n  doc.push(i.mvp_scope || '-');\n  doc.push('');\n  doc.push('ARCHITECTURE');\n  doc.push(i.architecture || '-');\n  doc.push('');\n  doc.push('RECOMMENDED STACK');\n  doc.push(i.recommended_stack || '-');\n  doc.push('');\n  doc.push('SKILLS YOU ALREADY HAVE');\n  doc.push(i.skills_you_have || '-');\n  doc.push('');\n  doc.push('NEW THINGS TO LEARN');\n  doc.push(i.skills_to_learn || '-');\n  doc.push('');\n  doc.push('BUILD ESTIMATE: ' + (i.build_estimate || '-'));\n  doc.push('MONETIZATION: ' + (i.monetization || '-'));\n  doc.push('VALIDATE FIRST: ' + (i.first_validation_step || '-'));\n  doc.push('RISKS: ' + (i.risks || '-'));\n  doc.push('');\n  doc.push('');\n});\nif (near.length) {\n  doc.push('==================================================');\n  doc.push('NEAR MISSES');\n  doc.push('==================================================');\n  near.forEach((i) => {\n    doc.push('- [' + i.opportunity_score + ', ' + i.confidence + ' confidence] ' + i.one_liner);\n    doc.push('  ' + breakdown(i) + ' | ' + whyNot(i));\n    doc.push('  Closest open source: ' + i.closest_open_source);\n    doc.push('  ' + i.url);\n  });\n}\n\nconst lines = [];\nlines.push('**PROBLEM RADAR (channel) - ' + dateLabel + '**');\nif (strong.length) {\n  lines.push(strong.length + ' idea(s) scored ' + minScore + '+:');\n  lines.push('');\n  strong.forEach((i, idx) => {\n    lines.push('**' + (idx + 1) + '. [' + i.opportunity_score + '/100, ' + i.confidence + ']** ' + cut(i.one_liner, 150));\n    lines.push(breakdown(i));\n    lines.push('<' + i.url + '>');\n    lines.push('');\n  });\n} else {\n  lines.push('No strong ideas today.');\n  lines.push('');\n}\nif (near.length) {\n  lines.push('Near misses:');\n  near.forEach((i) => lines.push('- [' + i.opportunity_score + '] ' + cut(i.one_liner, 90) + ' (' + cut(whyNot(i), 60) + ')'));\n}\nconst discord = lines.join(NL).slice(0, 1600 - statLine.length) + NL + NL + statLine;\n\nreturn [{ json: { doc_title: 'Problem Radar (channel) - ' + dateIso, doc_text: doc.join(NL), discord_text: discord, ideas: ideas, stats: stats } }];",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "fc9d54b9-a584-491c-a8e5-b1349ae41bdf",
      "name": "Create Report Doc",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        660,
        1400
      ],
      "parameters": {
        "authentication": "oAuth2",
        "content": "={{ $json.doc_text }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Config').first().json.drive_folder_id }}"
        },
        "name": "={{ $json.doc_title }}",
        "operation": "createFromText",
        "options": {
          "convertToGoogleDocument": true
        },
        "resource": "file"
      }
    },
    {
      "id": "81d5bb84-43a9-4aee-b655-de6382a2c861",
      "name": "Prepare Rows",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        1400
      ],
      "parameters": {
        "jsCode": "const doc = $input.first().json;\nconst url = 'https://docs.google.com/document/d/' + doc.id + '/edit';\nconst cfg = $('Config').first().json;\nconst ideas = $('Build Report').first().json.ideas || [];\nconst cut = (s, n) => String(s || '').slice(0, n);\nreturn ideas.map((i) => ({ json: {\n  post_id: i.post_id, title: i.title, url: i.url, source: i.source,\n  upvotes: i.upvotes, num_comments: i.num_comments, posted_at: i.posted_at,\n  pain_score: i.pain_score, buildable_score: i.buildable_score, wtp_score: i.wtp_score,\n  competition_gap_score: i.competition_gap_score, reachability_score: i.reachability_score, opportunity_score: i.opportunity_score,\n  who_has_problem: cut(i.who_has_problem, 500), summary: cut(i.summary, 1000), workaround: cut(i.workaround, 1000),\n  wtp_signals: cut(i.wtp_signals, 1000), app_angle: cut(i.app_angle, 1000),\n  competitors: cut(i.competitors + '\\nClosest open source: ' + i.closest_open_source, 2000),\n  mvp_idea: cut(i.one_liner, 1000), confidence_flags: cut(i.confidence + (i.confidence_flags ? ': ' + i.confidence_flags : ''), 1000),\n  run_model: cfg.triage_model + ' / ' + cfg.analysis_model, report_url: url, status: i.status\n} }));",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "acc76214-9ae2-4a95-84d9-2f6f6f2c3f5e",
      "name": "Save Digested Ideas",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        1100,
        1400
      ],
      "parameters": {
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "app_angle": "={{ $json.app_angle }}",
            "buildable_score": "={{ $json.buildable_score }}",
            "competition_gap_score": "={{ $json.competition_gap_score }}",
            "competitors": "={{ $json.competitors }}",
            "confidence_flags": "={{ $json.confidence_flags }}",
            "mvp_idea": "={{ $json.mvp_idea }}",
            "num_comments": "={{ $json.num_comments }}",
            "opportunity_score": "={{ $json.opportunity_score }}",
            "pain_score": "={{ $json.pain_score }}",
            "post_id": "={{ $json.post_id }}",
            "posted_at": "={{ $json.posted_at }}",
            "reachability_score": "={{ $json.reachability_score }}",
            "report_url": "={{ $json.report_url }}",
            "run_model": "={{ $json.run_model }}",
            "source": "={{ $json.source }}",
            "status": "={{ $json.status }}",
            "summary": "={{ $json.summary }}",
            "title": "={{ $json.title }}",
            "upvotes": "={{ $json.upvotes }}",
            "url": "={{ $json.url }}",
            "who_has_problem": "={{ $json.who_has_problem }}",
            "workaround": "={{ $json.workaround }}",
            "wtp_score": "={{ $json.wtp_score }}",
            "wtp_signals": "={{ $json.wtp_signals }}"
          }
        },
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_DATA_TABLE_ID"
        },
        "operation": "insert",
        "resource": "row"
      }
    },
    {
      "id": "123a3dbf-ef36-4cd8-8ee2-130fb9fa5802",
      "name": "Send Discord Digest",
      "type": "n8n-nodes-base.discord",
      "typeVersion": 2,
      "position": [
        1320,
        1400
      ],
      "parameters": {
        "authentication": "webhook",
        "content": "={{ $('Build Report').first().json.discord_text }}\nFull report: {{ $('Prepare Rows').first().json.report_url }}",
        "operation": "sendLegacy",
        "options": {},
        "resource": "message"
      },
      "executeOnce": true
    },
    {
      "id": "05113b37-f19e-4b61-b0a0-f9ca4a03d9c6",
      "name": "Check Triage Health",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        520
      ],
      "parameters": {
        "jsCode": "// If no post was triaged, the run would stop silently before the report. Say why instead.\nconst items = $input.all();\nconst ok = items.filter((i) => Number(i.json.pain_score) >= 0).length;\nif (ok > 0) return [];\nconst errs = $('AI Triage Post').all().map((i) => i.json.error).filter(Boolean);\nconst first = errs.length ? (typeof errs[0] === 'string' ? errs[0] : (errs[0].message || JSON.stringify(errs[0]))) : 'no error message (model returned unusable output)';\nconst model = $('Config').first().json.triage_model;\nreturn [{ json: { alert: 'Problem Radar (channel edition) stopped: 0 of ' + items.length + ' posts were triaged, so there is no digest today. Triage model: ' + model + '. First error: ' + String(first).slice(0, 300) } }];",
        "language": "javaScript",
        "mode": "runOnceForAllItems"
      }
    },
    {
      "id": "7382677c-0823-4b6d-b18e-6caa1cd217a7",
      "name": "Send Triage Failure",
      "type": "n8n-nodes-base.discord",
      "typeVersion": 2,
      "position": [
        1100,
        520
      ],
      "parameters": {
        "authentication": "webhook",
        "content": "={{ $json.alert }}",
        "operation": "sendLegacy",
        "options": {},
        "resource": "message"
      }
    },
    {
      "id": "607f91f3-8331-4efc-b8ec-d8f696c0d217",
      "name": "Stage: 0 Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        160,
        -260
      ],
      "parameters": {
        "content": "## Stage: 0 Config\nModels, context size, score bar, builder profile and scoring rules - the only node a viewer needs to edit\n\nSet `ollama_url`, `searxng_url`, `triage_model`, `analysis_model`, `num_ctx` (8192), `min_opportunity_score`, `drive_folder_id` and `builder_profile`. Pull both models in Ollama first.",
        "width": 340,
        "height": 460
      }
    },
    {
      "id": "cd30e974-9faa-4d41-8064-0a48531474d0",
      "name": "Stage: 1 Collect from official APIs",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        380,
        -260
      ],
      "parameters": {
        "content": "## Stage: 1 Collect from official APIs\nApp Store low-star reviews, Hacker News, GitHub issues and Stack Exchange - public APIs only",
        "width": 1880,
        "height": 460
      }
    },
    {
      "id": "4ce84557-2a60-48d4-81c9-54a765c1743e",
      "name": "Stage: 2 Triage with a small local model",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        40
      ],
      "parameters": {
        "content": "## Stage: 2 Triage with a small local model\nSkips posts already seen, scores pain and buildability, clamps bad numbers, keeps real problems, alerts if none could be triaged\n\nCreate an n8n Data Table first and put its ID in Skip Seen Posts, Save Skipped Posts and Save Digested Ideas. Columns: post_id (string), title (string), url (string), source (string), upvotes (number), num_comments (number), posted_at (date), pain_score (number), buildable_score (number), wtp_score (number), competition_gap_score (number), reachability_score (number), opportunity_score (number), who_has_problem (string), summary (string), workaround (string), wtp_signals (string), app_angle (string), competitors (string), mvp_idea (string), confidence_flags (string), run_model (string), report_url (string), status (string)",
        "width": 1440,
        "height": 680
      }
    },
    {
      "id": "f27ca14e-4bf7-46c7-81bf-62634655a923",
      "name": "Stage: 3 Competitor search",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        440
      ],
      "parameters": {
        "content": "## Stage: 3 Competitor search\nTop 8 ideas get two SearXNG searches: existing products and open-source alternatives",
        "width": 1440,
        "height": 460
      }
    },
    {
      "id": "5746d022-e9b6-425b-888c-b78ad2ea3987",
      "name": "Stage: 4 Score and check",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        740
      ],
      "parameters": {
        "content": "## Stage: 4 Score and check\nModel scores five factors; code validates and retries, removes invented names, flags contradictions, computes score",
        "width": 1880,
        "height": 680
      }
    },
    {
      "id": "dd504eed-81d9-4925-b4fe-0519bae97273",
      "name": "Stage: 5 Plan and report",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        1140
      ],
      "parameters": {
        "content": "## Stage: 5 Plan and report\nMVP plan only for strong ideas, then Google Doc, data table and Discord digest with a run summary",
        "width": 1660,
        "height": 460
      }
    }
  ],
  "connections": {
    "Run Manually": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Build App Chart Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build App Chart Requests": {
      "main": [
        [
          {
            "node": "Fetch App Charts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch App Charts": {
      "main": [
        [
          {
            "node": "Build Review Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Review Requests": {
      "main": [
        [
          {
            "node": "Fetch App Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch App Reviews": {
      "main": [
        [
          {
            "node": "Normalize Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Reviews": {
      "main": [
        [
          {
            "node": "Build Search Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Search Requests": {
      "main": [
        [
          {
            "node": "Fetch Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Sources": {
      "main": [
        [
          {
            "node": "Normalize Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Triage Model (local)": {
      "ai_languageModel": [
        [
          {
            "node": "AI Triage Post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Posts": {
      "main": [
        [
          {
            "node": "Skip Seen Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip Seen Posts": {
      "main": [
        [
          {
            "node": "Cap Triage Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cap Triage Batch": {
      "main": [
        [
          {
            "node": "AI Triage Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Triage Post": {
      "main": [
        [
          {
            "node": "Merge Triage Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Triage Fields": {
      "main": [
        [
          {
            "node": "Triage Succeeded",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Triage Health",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Triage Succeeded": {
      "main": [
        [
          {
            "node": "Worth a Deeper Look?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Worth a Deeper Look?": {
      "main": [
        [
          {
            "node": "Rank Shortlist",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Save Skipped Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rank Shortlist": {
      "main": [
        [
          {
            "node": "Keep Top 8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep Top 8": {
      "main": [
        [
          {
            "node": "Search Competitors (SearXNG)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Competitors (SearXNG)": {
      "main": [
        [
          {
            "node": "Add Competitor Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Competitor Context": {
      "main": [
        [
          {
            "node": "Search Open Source (SearXNG)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Open Source (SearXNG)": {
      "main": [
        [
          {
            "node": "Add Open Source Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Model (local)": {
      "ai_languageModel": [
        [
          {
            "node": "AI Score Opportunity",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Add Open Source Context": {
      "main": [
        [
          {
            "node": "AI Score Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Score Opportunity": {
      "main": [
        [
          {
            "node": "Merge Score Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Score Fields": {
      "main": [
        [
          {
            "node": "Validate & Retry Scores",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Retry Scores": {
      "main": [
        [
          {
            "node": "Ground Competitor Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ground Competitor Names": {
      "main": [
        [
          {
            "node": "Compute Score & Flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute Score & Flags": {
      "main": [
        [
          {
            "node": "Analysis Succeeded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analysis Succeeded": {
      "main": [
        [
          {
            "node": "Rank by Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rank by Opportunity": {
      "main": [
        [
          {
            "node": "Keep Top 5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep Top 5": {
      "main": [
        [
          {
            "node": "Plan Strong Ideas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Plan Strong Ideas": {
      "main": [
        [
          {
            "node": "Collect Top Ideas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Top Ideas": {
      "main": [
        [
          {
            "node": "Build Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Report": {
      "main": [
        [
          {
            "node": "Create Report Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Report Doc": {
      "main": [
        [
          {
            "node": "Prepare Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Rows": {
      "main": [
        [
          {
            "node": "Save Digested Ideas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Digested Ideas": {
      "main": [
        [
          {
            "node": "Send Discord Digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Triage Health": {
      "main": [
        [
          {
            "node": "Send Triage Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}