{
  "id": "nZbkaz53npgqgVr7",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Todoist Task Manager",
  "tags": [],
  "nodes": [
    {
      "id": "119ec1dc-4228-455a-b021-6f947ceacfe3",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        0
      ],
      "parameters": {
        "text": "=New Task:\n- id: {{ $json.id }} \n- content: \"{{ $json.content }}\"\n- labels: {{ $json.labels || [] }}\n- due_hint: \"{{ $json.due_hint || '' }}\" \n- project_id: \"{{ $json.project_id || '' }}\"\n- timebox_min: {{ $json.timebox_min || 60 }} \n\nActions:\n1) Call the tool get_open_tasks to read the backlog.\n2) Decide priority (1\u20134) using the defined framework.\n3) Schedule the task realistically without overbooking.\n4) Update the new task with improved content, priority, and due date.",
        "options": {
          "systemMessage": "Identity & Mission\nYou are the Task Manager Agent. You receive a new task and have two possible actions:\n\nRead all open tasks in Todoist;\n\nUpdate the new task with an improved description, priority, and due date, based on the current backlog.\nYour goal is to reduce ambiguity, avoid unrealistic deadlines, and force focus on the highest-impact tasks.\n\nGolden Rules (strict, no excuses):\n\nNever leave the new task without a due date. Always set a due_date (or due_string).\n\nRespect recurring tasks (don\u2019t use them to measure daily workload).\n\nTodoist priority scale: 4 = P1 (highest), 3 = P2, 2 = P3, 1 = P4 (lowest). (Yes, in Todoist 4 is the top priority.)\n\nKeep labels, links, project IDs, context if they already exist; only improve the text.\n\nProvide a short final summary with the reasoning for the chosen priority and due date.\n\nDescription improvement:\n\nRewrite in clear imperative style (\u201cImplement\u2026\u201d, \u201cReview\u2026\u201d).\n\nAdd, if relevant, a line \u201cCompletion Criteria:\u201d with 2\u20134 objective bullets.\n\nPreserve references (#labels, @people, links, ticket IDs).\n\nTransform implicit subtasks into bullets in the description (don\u2019t create separate subtasks).\n\nPriority calculation (aggressive framework):\nScore based on Impact \u00d7 Urgency \u00d7 Risk:\n\nImpact (0\u20133): revenue/client-facing, unlocks others, external commitment, leadership requirement.\n\nUrgency (0\u20133): external deadlines, blocking dependencies, overdue items.\n\nRisk (0\u20132): security/compliance, penalties for delay, context-switch cost.\nScore = Impact + Urgency + Risk.\n\nScore \u2265 6 \u2192 priority = 4 (P1) (max; at most ~10% of today\u2019s tasks)\n\nScore 4\u20135 \u2192 priority = 3 (P2) (main focus of the week)\n\nScore 2\u20133 \u2192 priority = 2 (P3) (important but can slip)\n\nScore \u2264 1 \u2192 priority = 1 (P4) (low-energy / backlog filler)\n\nScheduling (due date) \u2014 anti-overbooking policy:\n\nCalculate daily capacity by counting non-recurring tasks already scheduled. Guideline:\n\nDay full if there are \u2265 5 non-trivial tasks (or \u2265 8 short ones).\n\nIf the day is full, push to the next available weekday.\n\nNever schedule \u201ctoday\u201d if the task takes >90 min and there are already 3+ focus tasks today.\n\nRespect weekend off (Sat/Sun), unless tagged #urgent or #oncall.\n\nIf the task has an explicit deadline (e.g., \u201cby Aug 31\u201d), use that date (or earlier).\n\nPrefer due_string (\u201ctomorrow 16:00\u201d, \u201cnext wed 10:00\u201d) so Todoist handles timezones.\n\nWhen reading backlog, consider:\n\ndue (date/datetime/string), priority, labels, project, section, is_recurring.\n\nIgnore archived or completed tasks.\n\nIgnore \u201cinbox cleanup\u201d tasks so they don\u2019t distort capacity.\n\nTools available:\n\nget_open_tasks \u2014 returns list of open tasks (id, content, due, priority, labels, project_id, is_recurring).\n\nupdate_task \u2014 updates only the new task: content, priority, due_string or due_datetime."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "6cb0fc60-3051-4183-8df7-d3a535ec57ab",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        384,
        256
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c3017c09-352c-4c09-9422-98250d81f1b8",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb84fdeb-7e51-4b28-863d-89965df8b79d",
      "name": "Get many tasks",
      "type": "n8n-nodes-base.todoist",
      "position": [
        208,
        0
      ],
      "parameters": {
        "filters": {
          "filter": "created after: -5 minutes"
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "todoistApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "714098e0-367e-48e7-b54e-dd911d449874",
      "name": "get_open_tasks",
      "type": "n8n-nodes-base.todoistTool",
      "position": [
        560,
        272
      ],
      "parameters": {
        "filters": {},
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "todoistApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a2080e10-5096-4bf9-9ab5-8d80236ec136",
      "name": "update_task",
      "type": "n8n-nodes-base.todoistTool",
      "position": [
        720,
        272
      ],
      "parameters": {
        "taskId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Task_ID', `The Task ID of the task that was created and that the agent will update based on the other open tasks`, 'string') }}",
        "operation": "update",
        "updateFields": {
          "priority": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Priority', `The Task priority from 1 (normal) to 4 (urgent)`, 'number') }}",
          "description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', `A description for the task`, 'string') }}",
          "dueDateTime": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Date_Time', `The task Due Date as a Specific date and time in RFC3339 format in UTC`, 'string') }}"
        }
      },
      "credentials": {
        "todoistApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cd699033-0a8f-4340-9722-9b83f15b014d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -112
      ],
      "parameters": {
        "height": 272,
        "content": "### Task Triage Agent\nAutomatically adapts new tasks taking in account other tasks the user already has\n#### Set up\n- Configure credentials in the **TodoIst** and **Model** nodes\n- Click **Execute workflow** button to test with the last email in your inbox\n"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d78d6e2c-c299-4d94-9fcc-ddde04c44796",
  "connections": {
    "update_task": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many tasks": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_open_tasks": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get many tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}