{
  "id": "czDg0Q7wsAoqYQIx",
  "name": "COO Task Prioritization",
  "tags": [],
  "nodes": [
    {
      "id": "39d955ab-7c8e-4faa-ae3d-948dfa5e0615",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        640,
        500
      ],
      "parameters": {
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "923a5e54-785a-4c4f-b6b8-f540bb1c4e19",
      "name": "Daily 9AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "28adcd8d-e4cf-45f7-ad32-16ffe30a525b",
      "name": "Fetch Tasks",
      "type": "n8n-nodes-base.asana",
      "position": [
        220,
        0
      ],
      "parameters": {
        "filters": {
          "project": ""
        },
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 1
    },
    {
      "id": "b43946e1-1b62-46fc-9211-72551b6c55c7",
      "name": "COO Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        660,
        0
      ],
      "parameters": {
        "text": "={{ $json.data }}",
        "options": {
          "systemMessage": "=You are a COO AI agent that helps prioritize operational tasks. Use the retrieved context from vector_database_tool to assess task urgency and strategic importance.\n\nFor the most priority task, output:\n\nTask Name\n\nPriority Level: High / Medium / Low\n\nDue Date\n\nReason for Priority\n\nConsider urgency (due date), impact on operations, and dependencies retrieved from vector knowledge.\nJust give back the most important task"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "b716a7b4-0357-4730-89b2-8bc295d5a22a",
      "name": "Save Prioritized Task",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1600,
        0
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "prioritized_tasks",
          "cachedResultName": "prioritized_tasks"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {
            "task_name": "={{ $json.output.tasks[0][\"Task Name\"] }}",
            "priority_level": "={{ $json.output.tasks[0][\"Priority Level\"] }}",
            "reason_for_priority": "={{ $json.output.tasks[0][\"Reason for Priority\"] }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "number",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "task_name",
              "type": "string",
              "display": true,
              "required": true,
              "displayName": "task_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "priority_level",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "priority_level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reason_for_priority",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reason_for_priority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "759f799a-d046-4609-8894-99a9b951e43f",
      "name": "Task Reasoning Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        560,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4e3a60ec-d900-44e9-beaf-0de5905d9b2e",
      "name": "Priority Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1120,
        180
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"tasks\": [\n    {\n      \"Task Name\": \"Review quarterly KPIs\",\n      \"Priority Level\": \"High\",\n      \"Reason for Priority\": \"Provides critical performance metrics for all departments; deadline is approaching.\"\n    },\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d7ae1305-e2f2-44c0-9c21-8cb29310a5d8",
      "name": "Task Knowledge Vector DB",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        820,
        220
      ],
      "parameters": {
        "name": "vector_database_tool",
        "description": "The information related to task prioritization is here"
      },
      "typeVersion": 1
    },
    {
      "id": "906b83fc-d501-4442-b470-3e90148ace33",
      "name": "Vector Query Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        960,
        440
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e2b8e43c-1f7e-43e0-bba1-d186776d1e2b",
      "name": "Generate Task Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        580,
        720
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "61c92166-6068-4884-ac39-af52ae4a496a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -480
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 680,
        "content": "## \ud83d\udd01 Section 1: Trigger & Data Retrieval\n\n### \ud83d\udd39 **Node: `Daily 9AM Trigger`**\n\n* **Function**: Starts the workflow every day at 9:00 AM.\n* **Type**: Time-based scheduler.\n* **Why**: Ensures task processing is automated and consistent on a daily schedule.\n\n### \ud83d\udd39 **Node: `Fetch Asana Tasks`**\n\n* **Function**: Retrieves all tasks from Asana that are due or assigned.\n* **Type**: API Connector to Asana.\n* **Why**: Acts as the entry point for incoming task data that needs prioritization.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c9d36c9c-2cd3-407c-bc97-c765e6cb3bc6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -600
      ],
      "parameters": {
        "color": 5,
        "width": 760,
        "height": 1480,
        "content": "## \ud83e\udde0 Section 2: AI Prioritization\n\n### \ud83d\udd39 **Node: `COO Task Prioritization Agent`**\n\n* **Function**: Uses an AI Agent to evaluate and assign a priority to each task.\n* **Inputs**: Raw task data from Asana.\n* **Outputs**:\n\n  * `task_name`\n  * `priority_level` (e.g., High, Medium, Low)\n  * `reason_for_priority` (a justification provided by the AI)\n* **Why**: Simulates a COO\u2019s judgment to focus on strategic and urgent tasks.\n\n### \ud83d\udd39 **Node: `Task Reasoning Model`**\n\n* **Function**: Enhances the AI Agent's decision-making by providing natural language reasoning.\n* **Model**: OpenAI Chat Model.\n* **Why**: Adds contextual understanding to why a task is important.\n\n### \ud83d\udd39 **Node: `Priority Output Parser`**\n\n* **Function**: Extracts structured data (task name, priority level, reasoning) from the AI\u2019s output.\n* **Why**: Ensures only clean, usable data is passed to the database layer."
      },
      "typeVersion": 1
    },
    {
      "id": "4030c4f7-140c-453b-8441-4ed230da0928",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        -460
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 640,
        "content": "## \ud83d\uddc3\ufe0f Section 3: Data Storage & Enrichment\n\n### \ud83d\udd39 **Node: `Save Prioritized Tasks`**\n\n* **Function**: Inserts each prioritized task into a PostgreSQL database.\n* **Fields**:\n\n  * `task_name`\n  * `priority_level`\n  * `reason_for_priority`\n* **Why**: Provides a persistent store for further reporting, monitoring, or automation."
      },
      "typeVersion": 1
    },
    {
      "id": "cd768682-0aee-41d9-bdbc-0b3e8509a042",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1980,
        -460
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"
      },
      "typeVersion": 1
    },
    {
      "id": "019cb716-597a-49b3-8eeb-fc523f210c8f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1980,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 2238,
        "content": "Absolutely! Here's a **very detailed, polished explanation** of your workflow \u2014 structured in a **clean, professional format** with icons and broken into **three logical sections**. This is suitable for documentation, presentations, or onboarding team members.\n\n---\n\n# \ud83e\udde0 COO Task Automation Workflow Documentation\n\nThis intelligent automation workflow simulates a **COO\u2019s decision-making** by prioritizing daily tasks fetched from Asana using AI. It operates autonomously every morning at 9 AM, analyzes the tasks using an AI reasoning engine with memory and context, and stores the prioritized outcomes in a structured database for operational use.\n\n---\n\n## \u23f0 1. Trigger & Task Collection\n\n### \ud83d\udcc5 **Automated Daily Start**\n\n* **Time-based Scheduling**: The system is configured to initiate **automatically every day at 9:00 AM** without any manual input.\n* This guarantees consistency in daily planning and ensures tasks are prioritized early in the workday.\n\n### \ud83d\udd17 **Integration with Asana**\n\n* The workflow connects directly to the **Asana task management platform**.\n* It fetches tasks assigned to the team or specific users, filtered by criteria such as due date, project, or tag.\n* These tasks include metadata like task name, description, due date, assignee, and any custom fields.\n* All this information becomes the **raw input** for the AI decision-making engine.\n\n---\n\n## \ud83e\udde0 2. Intelligent Task Prioritization\n\n### \ud83e\udd16 **AI-Powered Prioritization Logic**\n\n* Once tasks are collected, they are passed to a custom **AI Agent**.\n* This AI agent plays the role of a **virtual COO**, applying strategic reasoning to prioritize tasks based on business urgency, impact, and context.\n\n### \ud83e\udde9 **Reasoning Through Language Models**\n\n* Behind the scenes, the agent leverages a **large language model (LLM)** to:\n\n  * Analyze each task's content.\n  * Cross-reference it with similar past tasks or organizational priorities.\n  * Generate an intelligent output:\n\n    * **Task Name**\n    * **Priority Level** (High, Medium, Low)\n    * **Reason for Priority** (justification written in natural language).\n\n### \ud83d\uddc2\ufe0f **Structured Output Conversion**\n\n* Since the AI outputs natural language, the system uses a **parser** to extract structured fields.\n* This step ensures that the response is normalized and can be cleanly inserted into a relational database.\n\n---\n\n## \ud83d\udce6 3. Enrichment & Persistent Storage\n\n### \ud83e\uddfe **Saving to PostgreSQL**\n\n* The structured data is stored in a **PostgreSQL database** with the following schema:\n\n  * `task_name`: The name or summary of the task.\n  * `priority_level`: Categorized as High, Medium, or Low.\n  * `reason_for_priority`: A brief but clear explanation of why the task received this priority.\n\n### \ud83d\udcda **Contextual Intelligence with Vector Embeddings**\n\n* To make future decisions more intelligent, the system incorporates a **semantic memory layer** using **vector databases** and **embeddings**.\n* All task-YOUR_OPENAI_KEY_HERE text is converted into **numerical vector representations** using an embeddings model.\n* These embeddings are stored in a **vector database**, enabling the AI agent to:\n\n  * Recall similar past tasks.\n  * Understand historical context.\n  * Find patterns across time and projects.\n\n### \ud83d\udd0d **Semantic Search & Retrieval**\n\n* When making prioritization decisions, the AI queries the vector database to retrieve **semantically similar tasks**.\n* This enables **context-aware decision-making**, allowing the AI to make better judgments based on past learnings, not just current inputs."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8c201cdf-caaa-423e-ad38-f6ac7955ff32",
  "connections": {
    "COO Agent": {
      "main": [
        [
          {
            "node": "Save Prioritized Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Tasks": {
      "main": [
        [
          {
            "node": "COO Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily 9AM Trigger": {
      "main": [
        [
          {
            "node": "Fetch Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vector Query Model": {
      "ai_languageModel": [
        [
          {
            "node": "Task Knowledge Vector DB",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Task Reasoning Model": {
      "ai_languageModel": [
        [
          {
            "node": "COO Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Task Knowledge Vector DB",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Priority Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "COO Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate Task Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Task Knowledge Vector DB": {
      "ai_tool": [
        [
          {
            "node": "COO Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}