{
  "name": "Todoist Task Manager",
  "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–4) 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’t 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 (“Implement…”, “Review…”).\n\nAdd, if relevant, a line “Completion Criteria:” with 2–4 objective bullets.\n\nPreserve references (#labels, @people, links, ticket IDs).\n\nTransform implicit subtasks into bullets in the description (don’t create separate subtasks).\n\nPriority calculation (aggressive framework):\nScore based on Impact × Urgency × Risk:\n\nImpact (0–3): revenue/client-facing, unlocks others, external commitment, leadership requirement.\n\nUrgency (0–3): external deadlines, blocking dependencies, overdue items.\n\nRisk (0–2): security/compliance, penalties for delay, context-switch cost.\nScore = Impact + Urgency + Risk.\n\nScore ≥ 6 → priority = 4 (P1) (max; at most ~10% of today’s tasks)\n\nScore 4–5 → priority = 3 (P2) (main focus of the week)\n\nScore 2–3 → priority = 2 (P3) (important but can slip)\n\nScore ≤ 1 → priority = 1 (P4) (low-energy / backlog filler)\n\nScheduling (due date) — anti-overbooking policy:\n\nCalculate daily capacity by counting non-recurring tasks already scheduled. Guideline:\n\nDay full if there are ≥ 5 non-trivial tasks (or ≥ 8 short ones).\n\nIf the day is full, push to the next available weekday.\n\nNever schedule “today” 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., “by Aug 31”), use that date (or earlier).\n\nPrefer due_string (“tomorrow 16:00”, “next wed 10:00”) 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 “inbox cleanup” tasks so they don’t distort capacity.\n\nTools available:\n\nget_open_tasks — returns list of open tasks (id, content, due, priority, labels, project_id, is_recurring).\n\nupdate_task — 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": {}
      },
      "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
      },
      "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
      },
      "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') }}"
        }
      },
      "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
    }
  ],
  "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
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
