{
  "name": "99problems",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Clean Emails').item.json.toJsonString() }}",
        "options": {
          "systemMessage": "=# CONTEXT\nYou are an AI inbox assistant responsible for processing incoming emails one at a time using a defined ruleset. Your role is to evaluate each email against all rules and execute only the specified actions for each matching rule. You must never take action outside the defined rules.\n\n# RULESET\nEach rule contains:\n- WHEN: the condition to evaluate\n- DO WHAT: the action to take if the condition matches\n- FOR: supporting data, explanations, or references\n\nHere is the current ruleset:\n{{ $('AddToEachEmail').item.json.instructions.toJsonString() }}\n\n# AVAILABLE USER LABELS\n{{ $('AddToEachEmail').item.json.labels.toJsonString() }}\n\n# INSTRUCTIONS\n1. Evaluate the incoming email against all rules independently. Each rule is a separate condition and must be considered on its own. Multiple rules can apply to the same message.\n\n2. For every rule that matches, execute all specified actions for that rule.  \n\n- If the rule specifies applying a Gmail label, use the label ID from the provided labels list when invoking a tool, not the label name. Match the name in your rule to the corresponding ID.\n\n- When sending a chat notification, write a concise but comprehensive message including key context from the email (sender and subject). Summarize any required action or decision clearly in 1\u20132 sentences avoiding unnecessary details or repetition. Always start the message with an appropriate emoji, and use no other emojis beyond that first one.\n\n- When sending an email reply, maintain a very polite and professional tone but keep it short and direct.\n\n3. If any rule matched and actions were taken, mark the email as read. If no rules matched, take no action and leave the email unread.\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        3080,
        -160
      ],
      "id": "65890450-9793-48ed-b544-806ab753090a",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -660,
        -140
      ],
      "id": "81a870dd-9309-44b3-957f-ba5f04323089",
      "name": "Every 5m",
      "disabled": true
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -660,
        60
      ],
      "id": "77a095f2-166b-494c-af44-26439157da55",
      "name": "Manual"
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "labelIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Label_Names_or_IDs', `Always use Label ID, never Names. One ID per tool call.`, 'string') }}"
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        3240,
        160
      ],
      "id": "4fc1fb64-3541-41c0-928c-1dd836650f50",
      "name": "Add Label",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "channelId": "REDACTED",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "attachments": [],
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.mattermostTool",
      "typeVersion": 1,
      "position": [
        3480,
        160
      ],
      "id": "a870124e-ba05-4d2c-bdd0-093d59a23a0c",
      "name": "Post to Chat",
      "credentials": {
        "mattermostApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -360,
        -40
      ],
      "id": "b9c26922-e052-45d6-8a97-94dcd45beba4",
      "name": "GO"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": []
        },
        "includeOtherFields": true,
        "include": "except",
        "excludeFields": "row_number",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        180
      ],
      "id": "8ee8f6df-70eb-492c-a4f4-ca206ffec317",
      "name": "Clean Instructions"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f6c8b7da-49de-4a6b-9fb9-c643c97f2efa",
              "name": "id",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "315bd56e-4687-4130-a722-552f9e8d3e12",
              "name": "from",
              "value": "={{ $json.from.text }}",
              "type": "string"
            },
            {
              "id": "3dada05d-526f-4973-b373-06afad7e9947",
              "name": "subject",
              "value": "={{ $json.subject }}",
              "type": "string"
            },
            {
              "id": "2bbc0e86-6193-4b16-bcdb-e39772315018",
              "name": "text",
              "value": "={{ $json.text.substring(0, 2000) }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1200,
        -160
      ],
      "id": "ddad1f68-334a-4bb0-8a45-43cd6f1b3da4",
      "name": "Clean Emails"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "REDACTED",
          "mode": "list",
          "cachedResultName": "REDACTED",
          "cachedResultUrl": "REDACTED"
        },
        "sheetName": {
          "__rl": true,
          "value": "REDACTED",
          "mode": "list",
          "cachedResultName": "REDACTED",
          "cachedResultUrl": "REDACTED"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        900,
        180
      ],
      "id": "6a247d07-65f3-4254-8533-eeb318dd3faf",
      "name": "Get Instructions",
      "executeOnce": false,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": 99,
        "simple": false,
        "filters": {
          "labelIds": [
            "UNREAD"
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1000,
        -160
      ],
      "id": "d56fcd6b-07e0-413b-810b-3d89fdfbd0b3",
      "name": "Get Unread Emails",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "markAsRead",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}"
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        3600,
        160
      ],
      "id": "5f25671e-2af6-4004-837d-7895b4423f56",
      "name": "Mark as Read",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "draft",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        3360,
        160
      ],
      "id": "73b190c3-038f-4601-8d0e-99b007a4218d",
      "name": "Draft Reply",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "# \u26a11. Triggers",
        "height": 460,
        "width": 270,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -740,
        -220
      ],
      "id": "a3c40f03-c5f4-43aa-9ecb-d828e2ca5134",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# \ud83d\udce7 2.1 Load emails",
        "height": 280,
        "width": 400,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        940,
        -240
      ],
      "id": "3cfb3545-d143-4766-b83c-ff2f8fa7c864",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "# \ud83e\udde0 3. AI applies instructions with tools",
        "height": 560,
        "width": 740,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3040,
        -240
      ],
      "id": "9053bbaf-7100-4023-80f4-8b2aa152a3b6",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "# \ud83d\uddd2\ufe0f 2.2 Load instructions",
        "height": 260,
        "width": 580,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        100
      ],
      "id": "3ca74aed-17c7-4bc9-b819-d6b552b3b359",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "# \ud83c\udff7\ufe0f 2.3 Load email labels",
        "height": 240,
        "width": 820,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        740,
        420
      ],
      "id": "47422a63-d658-43a7-9337-4391af9b35e1",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "resource": "label",
        "returnAll": true
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        800,
        500
      ],
      "id": "48768990-db30-4781-a7fb-44e540a0b0d0",
      "name": "Get Labels",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "54ffc413-03f1-4c9c-a7b4-66421af51ba8",
              "leftValue": "={{ $json.type }}",
              "rightValue": "user",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        1000,
        500
      ],
      "id": "68d3acc7-9939-4b84-bed3-1e08c541dde5",
      "name": "User Labels Only"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ad7031d9-0f17-4dd1-a0ad-7e53ba8129e3",
              "name": "name",
              "value": "={{ $json.name }}",
              "type": "string"
            },
            {
              "id": "02557f4e-d06f-46cc-9bc2-6f84c131a6fe",
              "name": "id",
              "value": "={{ $json.id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1200,
        500
      ],
      "id": "d9e6d357-0518-4c36-9273-a9104f114fec",
      "name": "Clean Labels"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "labels",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        1400,
        500
      ],
      "id": "6b49a1e3-ee27-47a3-808e-ff0a59ce0413",
      "name": "LabelsList"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "instructions",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        1280,
        180
      ],
      "id": "5e741993-5c7f-45ce-bb60-b420a0dded23",
      "name": "RulesList"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1760,
        340
      ],
      "id": "1a96aeca-31ac-402f-a31e-5adb11442371",
      "name": "2into1"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        2000,
        -140
      ],
      "id": "e692890c-e629-4f49-a955-be8768b33595",
      "name": "AddToEachEmail"
    },
    {
      "parameters": {
        "content": "## Triggers could be any of 109...",
        "height": 380,
        "width": 860,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1220,
        300
      ],
      "id": "21266dfa-b8b2-47cf-b273-05c351a36921",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "content": "# \u2699\ufe0f 2. Context Engineering (front-loading)",
        "height": 1120,
        "width": 1740
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        440,
        -360
      ],
      "id": "64a5af5c-40a6-425e-9148-24c263da888f",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "path": "2271f48f-9a0b-4e5a-a1e6-9b2eca4548e8",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -540,
        520
      ],
      "id": "0e9812f4-a1dd-47d5-84f8-80223e90f58d",
      "name": "Webhook",
      "disabled": true
    },
    {
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "events": [
          "commit_comment"
        ],
        "options": {}
      },
      "type": "n8n-nodes-base.githubTrigger",
      "typeVersion": 1,
      "position": [
        -980,
        520
      ],
      "id": "d0690174-0264-4502-9b8c-8df6b76c56b8",
      "name": "GitHub",
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {
              "name": "ticket.creation"
            }
          ]
        },
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.hubspotTrigger",
      "typeVersion": 1,
      "position": [
        -760,
        360
      ],
      "id": "b85e016b-3547-46d8-bae2-5c8796ea1033",
      "name": "HubSpot",
      "disabled": true
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "type": "n8n-nodes-base.notionTrigger",
      "typeVersion": 1,
      "position": [
        -980,
        360
      ],
      "id": "c12f3b23-ba41-46e1-842a-77ec4cb6dfcd",
      "name": "Notion",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "events": [
          "jira:issue_created"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.jiraTrigger",
      "typeVersion": 1.1,
      "position": [
        -1180,
        360
      ],
      "id": "fc71ef1d-776e-4d4c-bf3d-5ec855e49143",
      "name": "Jira",
      "disabled": true
    },
    {
      "parameters": {
        "topic": "carts/create"
      },
      "type": "n8n-nodes-base.shopifyTrigger",
      "typeVersion": 1,
      "position": [
        -760,
        520
      ],
      "id": "6918813a-a86b-4b76-a577-a62f4ee9fcc8",
      "name": "Shopify",
      "disabled": true
    },
    {
      "parameters": {
        "content": "![](https://media.licdn.com/dms/image/v2/C4E12AQH3OOMk8HYdEg/article-cover_image-shrink_600_2000/article-cover_image-shrink_600_2000/0/1591678256452?e=2147483647&v=beta&t=X6s_Rf3dBqGT22ZCYrj7xE_sCvmrlDrmZ-YiKX1EwFU)",
        "height": 260,
        "width": 420,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1220,
        20
      ],
      "id": "922780df-e4c2-47ef-9e40-7cb16fd458e3",
      "name": "Sticky Note7"
    },
    {
      "parameters": {
        "content": "![](https://pbs.twimg.com/media/DRHzRxwVQAAMK-W.jpg)",
        "height": 260,
        "width": 330,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3800,
        140
      ],
      "id": "7d33abd6-b91f-4534-8dcd-69e7faca9752",
      "name": "Sticky Note8"
    },
    {
      "parameters": {
        "content": "## Tools could be any of 262...",
        "height": 360,
        "width": 660,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3800,
        -240
      ],
      "id": "b07f77c8-a4f9-4d27-8ccc-c5f0c7c7d055",
      "name": "Sticky Note9"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1,
      "position": [
        4320,
        -40
      ],
      "id": "f09061e4-56a5-4e16-a5a0-837050d63bc2",
      "name": "MCP Client",
      "disabled": true
    },
    {
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "issueType": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.jiraTool",
      "typeVersion": 1,
      "position": [
        3840,
        -180
      ],
      "id": "115b78ef-27b5-4f3d-b423-aa9381974477",
      "name": "Jira Tool",
      "disabled": true
    },
    {
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtableTool",
      "typeVersion": 2.1,
      "position": [
        3840,
        -40
      ],
      "id": "1a7a9f13-70eb-460d-9d25-79feb77f753b",
      "name": "Airtable Tool",
      "disabled": true
    },
    {
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notionTool",
      "typeVersion": 2.2,
      "position": [
        3960,
        -180
      ],
      "id": "13c4a7a3-12f8-4d25-a42c-481a7fe0d8c5",
      "name": "Notion Tool",
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "labels": [],
        "assignees": []
      },
      "type": "n8n-nodes-base.githubTool",
      "typeVersion": 1.1,
      "position": [
        3960,
        -40
      ],
      "id": "2e6b679b-6e2d-495f-8313-b0c0b956ba66",
      "name": "GitHub Tool",
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "additionalFields": {},
        "options": {}
      },
      "type": "n8n-nodes-base.hubspotTool",
      "typeVersion": 2.1,
      "position": [
        4080,
        -180
      ],
      "id": "a0fa788a-0178-410a-ba4c-92177f3684b5",
      "name": "HubSpot Tool",
      "disabled": true
    },
    {
      "parameters": {
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.bambooHrTool",
      "typeVersion": 1,
      "position": [
        4200,
        -180
      ],
      "id": "bc7e4313-b223-4b42-9f9c-e96da367e98f",
      "name": "BambooHR Tool",
      "disabled": true
    },
    {
      "parameters": {
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.shopifyTool",
      "typeVersion": 1,
      "position": [
        4080,
        -40
      ],
      "id": "e09e75a9-e7ec-4433-b5bb-2bdaa5fb759d",
      "name": "Shopify Tool",
      "disabled": true
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.twilioTool",
      "typeVersion": 1,
      "position": [
        4200,
        -40
      ],
      "id": "ff0903a1-9931-44f5-83e4-889064028ba0",
      "name": "SMS Tool",
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        4320,
        -180
      ],
      "id": "d5081ec3-a7da-4658-b0bf-46633cda4b09",
      "name": "HTTP Tool",
      "disabled": true
    },
    {
      "parameters": {
        "content": "# \u231a START TO FINISH\n\n# 2-3 hours\n## - Connect your system(s)\n## - Build the flow\n## - Craft your prompt\n## - Test, debug, polish",
        "height": 340,
        "width": 420,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1220,
        -340
      ],
      "id": "f4abdac9-aeb3-40ce-b66a-1d53b1221acd",
      "name": "Sticky Note10"
    },
    {
      "parameters": {
        "trigger": [
          "message"
        ],
        "channelId": "REDACTED",
        "options": {}
      },
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        -540,
        360
      ],
      "id": "487cc975-72ae-4261-b56c-03f2f6bd69d1",
      "name": "Slack",
      "disabled": true
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "baseId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "tableId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.airtableTrigger",
      "typeVersion": 1,
      "position": [
        -1180,
        520
      ],
      "id": "1b4aee0f-a27b-4c5b-bb4c-fbc4989fdbd2",
      "name": "Airtable",
      "disabled": true
    },
    {
      "parameters": {
        "content": "![](https://media.licdn.com/dms/image/v2/D4E22AQH0IUehuXsFTw/feedshare-shrink_2048_1536/B4EZeD37dhHYAs-/0/1750264167312?e=1756339200&v=beta&t=6B2VfJuKiVlqT0RXfn0D5w_6rXupDOE_P1_0r9Y9HYg)",
        "height": 300,
        "width": 280,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2680,
        220
      ],
      "id": "7dfb3259-ff98-446d-9b65-0bad30974289",
      "name": "Sticky Note11"
    },
    {
      "parameters": {
        "mode": "delete",
        "deleteMode": "all"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "typeVersion": 1.1,
      "position": [
        3420,
        -120
      ],
      "id": "bde39487-24be-41d2-b390-e1ab2e4f0d7a",
      "name": "Reset"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        520,
        -40
      ],
      "id": "605270f9-fc91-4e17-94ca-fab15231f3b5",
      "name": "Stage"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "99problems",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        3080,
        120
      ],
      "id": "113fcb54-1b64-4378-8cda-c6fbb6805c9c",
      "name": "Ephemeral Memory"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        2720,
        -140
      ],
      "id": "9c9fbb92-7c6d-4d3a-87e5-876f6b11bb0c",
      "name": "1 by 1"
    },
    {
      "parameters": {
        "model": "REDACTED",
        "options": {
          "temperature": 0.3,
          "frequencyPenalty": 1.3,
          "numCtx": 16384
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        2780,
        100
      ],
      "id": "c0f62b93-e119-4e63-b39c-47dfa3fc187c",
      "name": "Local AI",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "![](https://pbs.twimg.com/media/DRHzRxwVQAAMK-W.jpg)",
        "height": 260,
        "width": 330,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -300,
        360
      ],
      "id": "27eddc8d-2f41-40d2-a2b6-0ecd656ed110",
      "name": "Sticky Note12"
    }
  ],
  "connections": {
    "Every 5m": {
      "main": [
        [
          {
            "node": "GO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual": {
      "main": [
        [
          {
            "node": "GO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Label": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Post to Chat": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GO": {
      "main": [
        [
          {
            "node": "Stage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Instructions": {
      "main": [
        [
          {
            "node": "RulesList",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Emails": {
      "main": [
        [
          {
            "node": "AddToEachEmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Instructions": {
      "main": [
        [
          {
            "node": "Clean Instructions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Unread Emails": {
      "main": [
        [
          {
            "node": "Clean Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Read": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Draft Reply": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Labels": {
      "main": [
        [
          {
            "node": "User Labels Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "User Labels Only": {
      "main": [
        [
          {
            "node": "Clean Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Labels": {
      "main": [
        [
          {
            "node": "LabelsList",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RulesList": {
      "main": [
        [
          {
            "node": "2into1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LabelsList": {
      "main": [
        [
          {
            "node": "2into1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "2into1": {
      "main": [
        [
          {
            "node": "AddToEachEmail",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "AddToEachEmail": {
      "main": [
        [
          {
            "node": "1 by 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        []
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reset": {
      "main": [
        [
          {
            "node": "1 by 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage": {
      "main": [
        [
          {
            "node": "Get Unread Emails",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Instructions",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ephemeral Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Reset",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "1 by 1": {
      "main": [
        [],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Local AI": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "42fde5be-12f5-49e0-997a-ac0f46ba6983",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "CT8neuAbyagQZ1Lz",
  "tags": []
}