AutomationFlowsAI & RAG › AI Message Classifier for Telegram

AI Message Classifier for Telegram

Original n8n title: [hub] Жора AI Classifier

[HUB] Жора AI Classifier. Uses executeWorkflowTrigger, httpRequest, supabase, telegram. Event-driven trigger; 14 nodes.

Event trigger★★★★☆ complexityAI-powered14 nodesExecute Workflow TriggerHTTP RequestSupabaseTelegramAgentOutput Parser StructuredOpenAI Chat
AI & RAG Trigger: Event Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Execute Workflow Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "[HUB] \u0416\u043e\u0440\u0430 AI Classifier",
  "description": null,
  "nodes": [
    {
      "id": "cls-trigger",
      "name": "When Called by \u0416\u043e\u0440\u0430",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "inputSource": "passthrough"
      }
    },
    {
      "id": "<uuid>",
      "name": "Check if Reply",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -600,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "reply-check",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.is_reply }}",
              "rightValue": true
            }
          ]
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Load Reply Context (RPC)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -400,
        -200
      ],
      "parameters": {
        "url": "https://your-project.supabase.co/rest/v1/rpc/find_context_by_reply",
        "method": "POST",
        "options": {
          "timeout": 30000
        },
        "jsonBody": "={\n  \"p_telegram_message_id\": {{ $json.reply_to_message_id }},\n  \"p_chat_id\": {{ $json.chat_id }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept-Profile",
              "value": "smm_army"
            },
            {
              "name": "Content-Profile",
              "value": "smm_army"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 2000
    },
    {
      "id": "<uuid>",
      "name": "Load Active Tasks",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -400,
        0
      ],
      "parameters": {
        "limit": 5,
        "schema": "smm_army",
        "tableId": "tasks",
        "operation": "getAll",
        "filterType": "string",
        "filterString": "=chat_id=eq.{{ $json.chat_id }}&status=in.(completed)&order=updated_at.desc&limit=5",
        "useCustomSchema": true
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Merge Context",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -200,
        0
      ],
      "parameters": {
        "numberInputs": 3
      }
    },
    {
      "id": "<TG_USER_ID>-c548-4ad5-b6b0-34d3179e5739",
      "name": "Extract Specific Context",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "jsCode": "// ============================================\n// \u041f\u0420\u041e\u0412\u0415\u0420\u041a\u0410: \u041e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435?\n// ============================================\n\nconst inputData = $input.first().json;\nconst messageData = $('When Called by \u0416\u043e\u0440\u0430').first().json;\n\n// ============================================\n// CASE 1: \u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 Load Context (RPC) \u2014 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442!\n// ============================================\n\nif (inputData.context_type) {\n  let content = inputData.content;\n  if (typeof content === 'string') {\n    try {\n      content = JSON.parse(content);\n    } catch (e) {\n      content = null;\n    }\n  }\n\n  let contextType = inputData.context_type;\n  if (contextType === 'photo_temp') {\n    contextType = 'photo';\n  } else if (contextType === 'forwarded_temp') {\n    contextType = 'forwarded';\n  }\n  \n  // \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 context\n  const contextData = {\n    context_type: contextType,\n    has_photo: contextType === 'photo',\n    photo_file_id: content?.photo_file_id || null,\n    has_forwarded: contextType === 'forwarded',\n    forwarded_content: contextType === 'forwarded' ? content : null,\n    task_id: inputData.task_id,\n    content: content\n  };\n  \n  // \u2705 \u041d\u041e\u0412\u041e\u0415: \u041f\u0430\u0440\u0441\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f POST\n  if (contextType === 'post') {\n    contextData.content = {\n      post_text: content?.text || '',\n      photo_file_id: content?.photo_file_id || null,\n      version: content?.version || 1,\n      sources: content?.sources || []\n    };\n  }\n\n  return {\n    json: {\n      user_message: messageData.text,\n      chat_id: messageData.chat_id,\n      message_id: messageData.message_id,\n      user_id: messageData.user_id,\n      reply_to_message_id: messageData.reply_to_message_id,\n      context: contextData\n    }\n  };\n}\n\n// \u0412\u0421\u0401 \u041e\u0421\u0422\u0410\u041b\u042c\u041d\u041e\u0415 \u0411\u0415\u0417 \u0418\u0417\u041c\u0415\u041d\u0415\u041d\u0418\u0419!\n// (CASE 2, CASE 0, \u0411\u041b\u041e\u041a 4, \u0411\u041b\u041e\u041a 5, \u041f\u0420\u0418\u041e\u0420\u0418\u0422\u0415\u0422 3 - \u041d\u0415 \u0422\u0420\u041e\u0413\u0410\u0415\u041c)\n\n// ============================================\n// CASE 2: Implicit context (NO Reply)\n// ============================================\n\nconst context = {\n  context_type: null,\n  content: null,\n  task_id: null,\n  has_forwarded: false,\n  forwarded_content: null,\n  has_photo: false,\n  photo_file_id: null\n};\n\nif (messageData.is_ready_photo_task === true) {\n  context.context_type = 'photo';\n  context.has_photo = true;\n  context.photo_file_id = messageData.photo_file_id;\n\n  return {\n    json: {\n      user_message: messageData.text,\n      chat_id: messageData.chat_id,\n      message_id: messageData.message_id,\n      user_id: messageData.user_id,\n      reply_to_message_id: messageData.reply_to_message_id,\n      context: context\n    }\n  };\n}\n\nlet recentMessages = [];\ntry {\n  const loadRecentData = $('Load Recent Messages').all();\n  if (loadRecentData && loadRecentData.length > 0) {\n    recentMessages = loadRecentData.map(item => {\n      const json = item.json;\n      if (json.content_data && typeof json.content_data === 'string') {\n        try {\n          json.content_data = JSON.parse(json.content_data);\n        } catch (e) {\n          console.log('Failed to parse content_data:', e);\n        }\n      }\n      return json;\n    });\n  }\n} catch (e) {\n  recentMessages = [];\n}\n\nif (recentMessages.length > 0) {\n  const clearCommand = recentMessages.find(m => \n    m.message_type === 'command' && \n    (m.content_data?.command === 'stop' || m.content_data?.command === 'start')\n  );\n\n  if (clearCommand) {\n    console.log(`[COMMAND] Found /${clearCommand.content_data.command}, checking if it clears context`);\n    \n    const lastPendingMessage = recentMessages.find(m =>\n      m.message_type === 'system' && \n      m.content_data && \n      (m.content_data.pending_photo || m.content_data.pending_forwarded)\n    );\n    \n    if (lastPendingMessage) {\n      const commandTime = new Date(clearCommand.created_at).getTime();\n      const pendingTime = new Date(lastPendingMessage.created_at).getTime();\n      \n      if (commandTime > pendingTime) {\n        console.log(`[COMMAND] Clearing implicit context (/${clearCommand.content_data.command} is newer than pending)`);\n        \n        return {\n          json: {\n            user_message: messageData.text,\n            chat_id: messageData.chat_id,\n            message_id: messageData.message_id,\n            user_id: messageData.user_id,\n            reply_to_message_id: messageData.reply_to_message_id,\n            context: {\n              context_type: null,\n              content: null,\n              task_id: null,\n              has_forwarded: false,\n              forwarded_content: null,\n              has_photo: false,\n              photo_file_id: null\n            }\n          }\n        };\n      } else {\n        console.log(`[COMMAND] /${clearCommand.content_data.command} is older than pending, ignoring`);\n      }\n    } else {\n      console.log(`[COMMAND] No pending context found, nothing to clear`);\n    }\n  }\n}\n\nif (recentMessages.length > 0) {\n  const lastSystemMessage = recentMessages\n    .filter(m => m.message_type === 'system' && m.content_data)\n    .sort((a, b) => new Date(b.created_at) - new Date(a.created_at))[0];\n\n  if (lastSystemMessage) {\n    if (lastSystemMessage.content_data.pending_photo) {\n      const photoMessageId = lastSystemMessage.content_data.pending_photo;\n      const photoMessage = recentMessages.find(m => m.telegram_message_id === photoMessageId);\n\n      if (photoMessage && photoMessage.content_data) {\n        context.context_type = 'photo';\n        context.has_photo = true;\n        context.photo_file_id = photoMessage.content_data.photo_file_id;\n      }\n    }\n    else if (lastSystemMessage.content_data.pending_forwarded) {\n      const forwardedMessageId = lastSystemMessage.content_data.pending_forwarded;\n      const forwardedMessage = recentMessages.find(m => m.telegram_message_id === forwardedMessageId);\n\n      if (forwardedMessage && forwardedMessage.content_data) {\n        context.context_type = 'forwarded';\n        context.has_forwarded = true;\n        context.forwarded_content = {\n          text: forwardedMessage.content_data.text,\n          forwarded_date: forwardedMessage.content_data.forwarded_date\n        };\n      }\n    }\n  }\n}\n\nif (!context.context_type && !messageData.reply_to_message_id) {\n  const allItems = $input.all();\n  \n  const lastSentMessage = allItems\n    .filter(item => \n      item.json?.message_type && \n      (item.json.message_type === 'longread' || item.json.task_id) &&\n      item.json.created_at\n    )\n    .sort((a, b) => new Date(b.json.created_at) - new Date(a.json.created_at))[0];\n  \n  if (lastSentMessage) {\n    console.log(`[TEMPORAL PROXIMITY] Found sent_message: ${lastSentMessage.json.message_type}`);\n    \n    if (lastSentMessage.json.message_type === 'longread') {\n      context.context_type = 'longread';\n      context.content = lastSentMessage.json.content_data;\n      if (typeof context.content === 'string') {\n        try {\n          context.content = JSON.parse(context.content);\n        } catch (e) {\n          console.log('[TEMPORAL PROXIMITY] Failed to parse longread:', e);\n        }\n      }\n    }\n    else if (lastSentMessage.json.task_id) {\n      const taskData = allItems.find(item => \n        item.json?.id === lastSentMessage.json.task_id &&\n        item.json?.department === 'research'\n      );\n      \n      if (taskData) {\n        context.context_type = 'research';\n        context.task_id = lastSentMessage.json.task_id;\n        context.content = taskData.json;\n      }\n    }\n  }\n}\n\nif (!context.context_type && messageData.reply_to_message_id) {\n  const allItems = $input.all();\n  const replyTarget = allItems.find(item => \n    item.json?.telegram_message_id === messageData.reply_to_message_id\n  );\n\n  if (replyTarget) {\n    console.log(`[REPLY CONTEXT] Found reply target: ${replyTarget.json.message_type}, task_id: ${replyTarget.json.task_id}`);\n    \n    if (replyTarget.json.message_type === 'longread') {\n      context.context_type = 'longread';\n      context.content = replyTarget.json.content_data;\n      if (typeof context.content === 'string') {\n        try {\n          context.content = JSON.parse(context.content);\n        } catch (e) {\n          console.log('[REPLY CONTEXT] Failed to parse longread content:', e);\n        }\n      }\n    }\n    else if (replyTarget.json.task_id) {\n      context.context_type = 'task';\n      context.task_id = replyTarget.json.task_id;\n    }\n    // \u2705 \u041d\u041e\u0412\u041e\u0415: \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 POST \u0432 allItems\n    else if (replyTarget.json.message_type === 'post') {\n  context.context_type = 'post';\n  context.content = {\n    post_text: replyTarget.json.content_data?.text || '',  // \u2705 \u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e!\n    photo_file_id: replyTarget.json.content_data?.photo_file_id || null,\n    version: replyTarget.json.content_data?.version || 1,\n    sources: replyTarget.json.content_data?.sources || []\n  };\n}\n  } else {\n    console.log(`[REPLY CONTEXT] Reply target not found: message_id ${messageData.reply_to_message_id}`);\n  }\n}\n\nreturn {\n  json: {\n    user_message: messageData.text,\n    chat_id: messageData.chat_id,\n    message_id: messageData.message_id,\n    user_id: messageData.user_id,\n    reply_to_message_id: messageData.reply_to_message_id,\n    context: context\n  }\n};"
      }
    },
    {
      "id": "<uuid>",
      "name": "Prepare AI Prompt",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        200,
        0
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\n// ============================================\n// USER PROMPT: \u0422\u041e\u041b\u042c\u041a\u041e \u0424\u0410\u041a\u0422\u042b!\n// ============================================\n\nlet userPrompt = `**\u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:**\n\"${data.user_message || data.text}\"\n`;\n\n// \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 (\u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u043a\u0442\u044b)\nif (data.context && data.context.context_type) {\n  \n  userPrompt += `\\n**\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442:**\\n`;\n  \n  if (data.context.context_type === 'photo') {\n    userPrompt += `- \u0422\u0438\u043f: \u0444\u043e\u0442\u043e\\n`;\n    userPrompt += `- Photo ID: ${data.context.photo_file_id}\\n`;\n  }\n  \n  else if (data.context.context_type === 'forwarded') {\n    userPrompt += `- \u0422\u0438\u043f: \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\\n`;\n    userPrompt += `- \u0422\u0435\u043a\u0441\u0442: \"${data.context.forwarded_content.text}\"\\n`;\n  }\n  \n  else if (data.context.context_type === 'longread') {\n    userPrompt += `- \u0422\u0438\u043f: \u043b\u043e\u043d\u0433\u0440\u0438\u0434\\n`;\n    if (data.context.content && data.context.content.news_list) {\n      userPrompt += `- \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u0438:\\n`;\n      userPrompt += data.context.content.news_list\n        .map(n => `  ${n.id}. ${n.title}`)\n        .join('\\n') + '\\n';\n    }\n  }\n  \n  else if (data.context.context_type === 'task') {\n    userPrompt += `- \u0422\u0438\u043f: \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430\\n`;\n    userPrompt += `- Task ID: ${data.context.task_id}\\n`;\n  }\n  \n  else {\n    userPrompt += `- \u0422\u0438\u043f: ${data.context.context_type}\\n`;\n  }\n  \n} else {\n  userPrompt += `\\n**\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442:** \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442\\n`;\n}\n\n// ============================================\n// \u0411\u0415\u0417\u041e\u041f\u0410\u0421\u041d\u041e\u0415 \u041e\u0411\u0420\u0410\u0429\u0415\u041d\u0418\u0415 \u041a LOAD ACTIVE TASKS\n// ============================================\n\nlet completedTasks = [];\n\ntry {\n  const loadTasksData = $('Load Active Tasks').all();\n  if (loadTasksData && loadTasksData.length > 0) {\n    completedTasks = loadTasksData;\n  }\n} catch (e) {\n  // Load Active Tasks \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u0438\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0443\n  completedTasks = [];\n}\n\n// \u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438\nconst validTasks = completedTasks.filter(task => task.json && task.json.id);\n\n// Completed \u0437\u0430\u0434\u0430\u0447\u0438 (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f iterative cycles)\nif (validTasks.length > 0) {\n  userPrompt += `\\n**\u0417\u0430\u0434\u0430\u0447\u0438 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c completed (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f task_update):**\\n`;\n  validTasks.forEach(task => {\n    const t = task.json;\n    userPrompt += `- ${t.department}: \"${t.initial_prompt}\" (ID: ${t.id}, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e: ${new Date(t.updated_at).toLocaleString('ru-RU')})\\n`;\n  });\n} else {\n  userPrompt += `\\n**\u0417\u0430\u0434\u0430\u0447\u0438 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c completed:** \u043d\u0435\u0442\\n`;\n}\n\n// ============================================\n// \u0418\u0417\u0412\u041b\u0415\u041a\u0410\u0415\u041c \u0414\u0410\u041d\u041d\u042b\u0415 \u0414\u041b\u042f ORIGINAL_DATA\n// ============================================\n\nconst completedTasksData = validTasks.map(task => task.json);\n\n// ============================================\n// \u0412\u041e\u0417\u0412\u0420\u0410\u0429\u0410\u0415\u041c \u0421 COMPLETED_TASKS\n// ============================================\n\nreturn {\n  json: {\n    user_prompt: userPrompt.trim(),\n    original_data: {\n      ...data,\n      completed_tasks: completedTasksData  // \u2190 \u041a\u041b\u042e\u0427\u0415\u0412\u041e\u0415 \u0418\u0417\u041c\u0415\u041d\u0415\u041d\u0418\u0415\n    }\n  }\n};"
      }
    },
    {
      "id": "<uuid>",
      "name": "Validate AI Output",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        600,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "intent-check",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.intent }}",
              "rightValue": ""
            },
            {
              "id": "department-check-if-new-task",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.intent === 'new_task' ? ($json.output.department || '') : 'ok' }}",
              "rightValue": ""
            }
          ]
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Send Error to Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        600,
        200
      ],
      "parameters": {
        "text": "\u0411\u0440\u0430\u0442, \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0437\u0430\u043f\u0440\u043e\u0441. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u0435\u0449\u0451 \u0440\u0430\u0437.",
        "chatId": "={{ $('When Called by \u0416\u043e\u0440\u0430').first().json.chat_id }}",
        "resource": "message",
        "operation": "sendMessage",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        400,
        0
      ],
      "parameters": {
        "text": "={{ $json.user_prompt }}",
        "options": {
          "systemMessage": "=\u0422\u044b \u2014 \u041a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043b\u044f SMM \u0430\u0433\u0435\u043d\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0439 INTENT \u0438 DEPARTMENT.\n\n## \u0422\u0415\u0420\u041c\u0418\u041d\u041e\u041b\u041e\u0413\u0418\u042f\n\n**\u0421\u0442\u0430\u0442\u0443\u0441\u044b \u0437\u0430\u0434\u0430\u0447 (\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0411\u0414):**\n\n| \u0421\u0442\u0430\u0442\u0443\u0441 | \u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 \u044d\u0442\u043e\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u0435 | \u0422\u0432\u043e\u0451 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 |\n|--------|------------------------------|---------------|\n| `created` | \u0422\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0443 | \u274c task_update \u041d\u0415\u0412\u041e\u0417\u041c\u041e\u0416\u0415\u041d |\n| `in_progress` | Department \u0430\u0433\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u0434 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 | \u274c task_update \u041d\u0415\u0412\u041e\u0417\u041c\u041e\u0416\u0415\u041d |\n| `completed` | \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 v1 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e | \u2705 task_update \u0412\u041e\u0417\u041c\u041e\u0416\u0415\u041d |\n| `failed` | \u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 | \u274c task_update \u041d\u0415\u0412\u041e\u0417\u041c\u041e\u0416\u0415\u041d |\n\n**\u0414\u043b\u044f iterative cycles:** \u0422\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c `completed` \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435.\n\n**\u041b\u043e\u0433\u0438\u043a\u0430:** \u0415\u0441\u043b\u0438 user \u0412\u0418\u0414\u0415\u041b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (v1 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 Telegram) \u2192 \u043c\u043e\u0436\u0435\u0448\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c `intent = task_update` \u0411\u0415\u0417 reply.\n\n**\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c:**\n- **completed_tasks** = \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c `completed` \u0438\u0437 \u0411\u0414 (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f task_update)\n- **sent_messages** = \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (research/longread \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b), \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u0434\u043b\u044f reply handling\n  - \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430: `{task_id, version_index, file_id, message_id, timestamp}`\n  - \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0448\u044c \u0434\u043b\u044f: reply context \u0438 temporal proximity \u043f\u0440\u0438 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445\n- **recent_messages** = 3 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0447\u0430\u0442\u0430\n  - \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0448\u044c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f: pending_photo, pending_forwarded (implicit context)\n\n## INTENT \u0442\u0438\u043f\u044b\n- **new_task** \u2014 \u043d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430\n- **task_update** \u2014 \u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c `completed` \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 reply)\n- **dialogue** \u2014 \u0443\u0442\u043e\u0447\u043d\u044f\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441\n\n## DEPARTMENT \u0442\u0438\u043f\u044b\n- **copywriting** \u2014 \u043f\u043e\u0441\u0442\u044b (\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 iterative cycles)\n- **research** \u2014 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b (Jina Deep Search + SerpAPI + \u0441\u0438\u043d\u0442\u0435\u0437), \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 report\n- **image_gen** \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 (\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 iterative cycles)\n- **image_edit** \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u043e\u0442\u043e (\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 iterative cycles)\n- **longwriter** \u2014 \u043b\u043e\u043d\u0433\u0440\u0438\u0434\u044b \u0438\u0437 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u044b\u0445/\u0437\u0430\u043c\u0435\u0442\u043e\u043a (GitHub Gist + \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442)\n- **reels_ideas** \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u0439 \u0438\u0437 \u0441\u0441\u044b\u043b\u043e\u043a (YouTube/TikTok/Instagram reels \u2192 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u043f\u0442 \u2192 \u0438\u0434\u0435\u044f \u0432 \u0431\u0430\u0437\u0435)\n\n**Triggers \u0434\u043b\u044f department routing:**\n- \"\u043d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442\", \"\u0441\u043e\u0437\u0434\u0430\u0439 \u043f\u043e\u0441\u0442\" \u2192 **copywriting**\n- \"\u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0439\", \"\u0440\u0430\u0437\u0431\u0435\u0440\u0438\", \"\u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u0440\u044b\u043d\u043e\u043a\" \u2192 **research**\n- \"\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443\", \"\u043d\u0430\u0440\u0438\u0441\u0443\u0439\" \u2192 **image_gen**\n- (\u0444\u043e\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043e) + \"\u043f\u043e\u043f\u0440\u0430\u0432\u044c\" \u2192 **image_edit**\n- \"\u043d\u0430\u043f\u0438\u0448\u0438 \u043b\u043e\u043d\u0433\u0440\u0438\u0434\", \"\u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f\", \"\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u043a\u0440\u043e\u0439\" \u2192 **longwriter**\n- (\u043b\u044e\u0431\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 URL \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438) \u0418\u041b\u0418 \"\u0441\u043e\u0445\u0440\u0430\u043d\u0438 \u0438\u0434\u0435\u044e\", \"\u0437\u0430\u043f\u0438\u0448\u0438 \u043c\u044b\u0441\u043b\u044c\" \u2192 **reels_ideas**\n**Triggers \u0434\u043b\u044f department routing:**\n- \"\u043d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442\", \"\u0441\u043e\u0437\u0434\u0430\u0439 \u043f\u043e\u0441\u0442\", \"\u0441\u0434\u0435\u043b\u0430\u0439 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443\" \u2192 **copywriting**\n- \"\u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0439\", \"\u0440\u0430\u0437\u0431\u0435\u0440\u0438\", \"\u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0438 \u043f\u0440\u043e\", \"\u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u0440\u044b\u043d\u043e\u043a\" \u2192 **research**\n- \"\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443\", \"\u043d\u0430\u0440\u0438\u0441\u0443\u0439\", \"create image\" \u2192 **image_gen**\n- (\u0444\u043e\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043e) + \"\u0438\u0441\u043f\u0440\u0430\u0432\u044c\", \"\u043f\u043e\u043f\u0440\u0430\u0432\u044c\" \u2192 **image_edit**\n\n\n**Longread** \u2014 \u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442 \u043d\u043e\u0432\u043e\u0441\u0442\u043d\u0430\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0430 (\u041d\u0415 department, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430)\n\n---\n\n## \u041f\u0420\u0410\u0412\u0418\u041b\u041e #0: PHOTO PRESENCE (\u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442)\n\n**\u0415\u0441\u043b\u0438 \u0422\u0415\u041a\u0423\u0429\u0415\u0415 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u043e\u0442\u043e:**\n\u2192 \u0412\u0421\u0415\u0413\u0414\u0410 `intent = new_task`, `department = image_edit`\n\u2192 \u0418\u0413\u041d\u041e\u0420\u0418\u0420\u041e\u0412\u0410\u0422\u042c \u043b\u044e\u0431\u043e\u0439 context (completed_tasks, pending_photo, \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b)\n\u2192 \u0424\u043e\u0442\u043e \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 = \u0441\u0431\u0440\u043e\u0441 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0437\u0430\u043d\u043e\u0432\u043e\n\n**\u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:** Reply \u0411\u0415\u0417 \u0444\u043e\u0442\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u2192 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 reply context (\u041f\u0420\u0410\u0412\u0418\u041b\u041e #1)\n\n---\n\n## \u041f\u0420\u0410\u0412\u0418\u041b\u041e #1: REPLY PRIORITY\n\n**\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c reply \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0411\u0415\u0417 \u0444\u043e\u0442\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438):**\n\u2192 `intent = task_update`\n\u2192 `target_task_id` = \u0438\u0437 reply context (sent_messages \u0438\u043b\u0438 completed_tasks)\n\u2192 \u0418\u0413\u041d\u041e\u0420\u0418\u0420\u041e\u0412\u0410\u0422\u042c \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b\n\n**\u0418\u0421\u041a\u041b\u042e\u0427\u0415\u041d\u0418\u0415:** Reply \u043d\u0430 research/longread \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b:\n- Reply + \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435\" \u2192 `new_task`, `copywriting` (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043a\u0430\u043a source)\n- Reply + \"\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0444\u043e\u043a\u0443\u0441\u043e\u043c\" \u2192 `new_task`, `research` (\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 research)\n- **\u041f\u0440\u0438\u0447\u0438\u043d\u0430:** Research \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u041d\u0415 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\n- **\u0422\u0432\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:** \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u2014 \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442\" = copywriting, \"\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439\" = \u043d\u043e\u0432\u044b\u0439 research\n\n**\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442:** Reply > Completed Tasks > Implicit Context\n\n---\n\n## \u041f\u0420\u0410\u0412\u0418\u041b\u041e #2: NEW_TASK vs TASK_UPDATE (Copywriting)\n\n**\u041a\u0420\u0418\u0422\u0418\u0427\u041d\u041e:** \u041e\u0442\u043b\u0438\u0447\u0430\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e.\n\n### Copywriting: new_task vs task_update (\u0411\u0415\u0417 reply)\n\n**new_task \u0435\u0441\u043b\u0438:**\n- \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 **\u043f\u043e\u043b\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e**: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e X\", \"\u0421\u043e\u0437\u0434\u0430\u0439 \u043f\u043e\u0441\u0442 \u043e Y\"\n- \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u043e **\u043d\u043e\u0432\u044b\u0439 \u0442\u043e\u043f\u0438\u043a** (\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d completed task)\n- \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0433\u043b\u0430\u0433\u043e\u043b\u044b: \"\u041d\u0430\u043f\u0438\u0448\u0438\", \"\u0421\u043e\u0437\u0434\u0430\u0439\", \"\u0421\u0434\u0435\u043b\u0430\u0439 \u043f\u043e\u0441\u0442\"\n\n**task_update \u0435\u0441\u043b\u0438:**\n- \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 **\u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f**: \"\u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0438\", \"\u0414\u043e\u0431\u0430\u0432\u044c\", \"\u0423\u0431\u0435\u0440\u0438\", \"\u0418\u0437\u043c\u0435\u043d\u0438\"\n- \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 **\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0438\u043b\u044f/\u043f\u043e\u0434\u0430\u0447\u0438**: \"\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443\", \"\u0434\u0430\u0432\u0430\u0439 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u0435\u0435\", \"\u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439 \u0441\u0442\u0438\u043b\u044c\", \"\u0441\u0434\u0435\u043b\u0430\u0439 \u043f\u0440\u043e\u0449\u0435\"\n- \u0417\u0430\u043f\u0440\u043e\u0441 **\u043e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0439**: \"\u0414\u043e\u0431\u0430\u0432\u044c \u044d\u043c\u043e\u0434\u0437\u0438\", \"\u0421\u0434\u0435\u043b\u0430\u0439 \u043a\u043e\u0440\u043e\u0447\u0435\", \"\u0410 \u0434\u0430\u0432\u0430\u0439 \u0438\u043d\u0430\u0447\u0435\" (\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442)\n- \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0433\u043b\u0430\u0433\u043e\u043b\u044b: \"\u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0438\", \"\u0414\u043e\u0431\u0430\u0432\u044c\", \"\u0423\u0431\u0435\u0440\u0438\", \"\u0418\u0437\u043c\u0435\u043d\u0438\", \"\u0421\u0434\u0435\u043b\u0430\u0439 \u043a\u043e\u0440\u043e\u0447\u0435\", \"\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\", \"\u0414\u0430\u0432\u0430\u0439\", \"\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439\"\n\n**\u041f\u0420\u0418\u041c\u0415\u0420\u042b:**\n\n\u2705 new_task:\n- \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e \u043d\u043e\u0432\u044b\u0439 iPhone\" \u2192 new_task\n- \"\u0421\u043e\u0437\u0434\u0430\u0439 \u043f\u043e\u0441\u0442 \u043e blockchain\" \u2192 new_task\n- \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043e 4 \u043d\u043e\u0432\u043e\u0441\u0442\u0438\" (completed: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043e 4 \u043d\u043e\u0432\u043e\u0441\u0442\u0438\") \u2192 new_task\n  - **\u041f\u0440\u0438\u0447\u0438\u043d\u0430:** \u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f = \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0441\u0442, \u043d\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\n\n\u2705 task_update:\n- \"\u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0438 \u043a\u043e\u0440\u043e\u0447\u0435\" (completed: copywriting) \u2192 task_update\n- \"\u0414\u043e\u0431\u0430\u0432\u044c \u0440\u0430\u0437\u0434\u0435\u043b \u043f\u0440\u043e Claude\" (completed: copywriting) \u2192 task_update\n- \"\u0423\u0431\u0435\u0440\u0438 \u0432\u043e\u0434\u0443\" (completed: copywriting) \u2192 task_update\n- \"\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u0435\u0435 \u0434\u043e\u043d\u0435\u0441\u0442\u0438\" (completed: copywriting) \u2192 task_update\n- \"\u0414\u0430\u0432\u0430\u0439 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043f\u0440\u043e\u0449\u0435\" (completed: copywriting) \u2192 task_update\n- \"\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439 \u043f\u043e\u0434\u0430\u0447\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\" (completed: copywriting) \u2192 task_update\n\n\u274c \u0422\u0418\u041f\u0418\u0427\u041d\u0410\u042f \u041e\u0428\u0418\u0411\u041a\u0410:\n- User: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043e X\"\n- Completed: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043e X\"\n- \u041d\u0415\u041f\u0420\u0410\u0412\u0418\u041b\u042c\u041d\u041e: task_update \u2190 User \u0445\u043e\u0447\u0435\u0442 \u041d\u041e\u0412\u042b\u0419 \u043f\u043e\u0441\u0442!\n- \u041f\u0420\u0410\u0412\u0418\u041b\u042c\u041d\u041e: new_task\n\n**\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435:**\n- \"\u041d\u0430\u043f\u0438\u0448\u0438\" / \"\u0421\u043e\u0437\u0434\u0430\u0439\" = **\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435** \u043d\u043e\u0432\u043e\u0433\u043e \u2192 new_task\n- \"\u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0438\" / \"\u0414\u043e\u0431\u0430\u0432\u044c\" / \"\u0423\u0431\u0435\u0440\u0438\" = **\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435** \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u2192 task_update\n\n### \u041d\u0435\u044f\u0432\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 completed_tasks (\u041f\u0420\u0418\u041e\u0420\u0418\u0422\u0415\u0422 #3)\n\n**\u0415\u0441\u043b\u0438:**\n- \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 **\u043d\u0435\u044f\u0432\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f**: \"\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\", \"\u0434\u0430\u0432\u0430\u0439\", \"\u0430 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442\"\n- `context.context_type = null` (\u043d\u0435\u0442 reply, \u043d\u0435\u0442 implicit context)\n- `completed_tasks` \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e department\n\n**\u0422\u041e:**\n- `intent = task_update`\n- `target_task_id` = \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e department (\u0441\u0430\u043c\u0430\u044f \u0441\u0432\u0435\u0436\u0430\u044f \u043f\u043e `updated_at`)\n\n**\u041f\u0420\u0418\u041c\u0415\u0420\u042b:**\n\n\u2705 task_update (\u043d\u0435\u044f\u0432\u043d\u044b\u0439):\n- User: \"\u0410 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u043e \u0434\u043e\u043d\u0435\u0441\u0442\u0438\"\n- completed_tasks: [copywriting \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0442 16:08:26, copywriting \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0442 15:29:43]\n- \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: `task_update`, `target_task_id` = copywriting \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0442 16:08:26 (\u0441\u0430\u043c\u0430\u044f \u0441\u0432\u0435\u0436\u0430\u044f)\n\n\u2705 task_update (\u043d\u0435\u044f\u0432\u043d\u044b\u0439):\n- User: \"\u0414\u0430\u0432\u0430\u0439 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443\"\n- completed_tasks: [copywriting \u0437\u0430\u0434\u0430\u0447\u0430]\n- \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: `task_update`, `target_task_id` = copywriting \u0437\u0430\u0434\u0430\u0447\u0430\n\n\u274c new_task (\u044f\u0432\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f):\n- User: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e X\"\n- completed_tasks: [copywriting \u0437\u0430\u0434\u0430\u0447\u0430]\n- \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: `new_task` (\u043f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f = \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0441\u0442)\n\n**\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435:**\n- \"\u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\", \"\u0434\u0430\u0432\u0430\u0439\", \"\u0430 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442\" = **\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u0442\u0438\u043b\u044f** \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u2192 task_update \u0441 target_task_id\n- \"\u041d\u0430\u043f\u0438\u0448\u0438\", \"\u0421\u043e\u0437\u0434\u0430\u0439\" = **\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435** \u043d\u043e\u0432\u043e\u0433\u043e \u2192 new_task\n\n---\n\n## TEMPORAL PROXIMITY (\u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u041e\u0431\u0449\u0435\u043d\u0438\u044f)\n\n**\u0424\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044f:** \u041e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043a\u0430\u043a \u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e.\n\n**\u041f\u0440\u0438\u043d\u0446\u0438\u043f:** \u0427\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439) \u2192 \u0442\u043e \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0435\n\n**\u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u0432 (\u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430):**\n\n1. **\u041f\u0420\u0410\u0412\u0418\u041b\u041e #0:** \u0424\u043e\u0442\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 (\u0410\u0411\u0421\u041e\u041b\u042e\u0422\u041d\u042b\u0419 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 - \u0441\u0431\u0440\u043e\u0441 \u0432\u0441\u0435\u0433\u043e)\n2. **\u041f\u0420\u0410\u0412\u0418\u041b\u041e #1:** Reply (\u0412\u042b\u0421\u041e\u041a\u0418\u0419 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435: research/longread)\n3. **\u041f\u0420\u0410\u0412\u0418\u041b\u041e #2:** NEW_TASK vs TASK_UPDATE \u0434\u043b\u044f Copywriting (\u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 vs \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435)\n4. **\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u043b\u0438\u0437\u043e\u0441\u0442\u044c:** \u0427\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 - pending context \u0438\u043b\u0438 sent_messages (\u043f\u043e timestamp)\n   - \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f = pending_photo \u2192 `image_edit`\n   - \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f = pending_forwarded \u2192 `copywriting`/`research`\n   - \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b = sent_messages \u2192 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043a\u0430\u043a source\n5. **Completed tasks:** \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 task_update \u043f\u043e department (\u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430)\n\n### \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u043b\u0438\u0437\u043e\u0441\u0442\u0438:\n\n**G1: pending_photo + pending_forwarded (\u043e\u0431\u0430 \u0435\u0441\u0442\u044c)**\n- User: Forwarded (10:00) \u2192 Photo (10:05) \u2192 \"\u0421\u0434\u0435\u043b\u0430\u0439 \u043e\u0431 \u044d\u0442\u043e\u043c\"\n\u2192 Photo \u043f\u043e\u0437\u0436\u0435 (10:05) \u2192 `image_edit`\n\n**G2: pending_photo + sent_messages**\n- System: Research \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d (10:00) \u2192 User: Photo (10:05) \u2192 \"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u044d\u0442\u043e\"\n\u2192 Photo \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0437\u0436\u0435 (10:05) \u2192 `image_edit`\n\n**F8: sent_messages + \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441**\n- System: Research \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d (10:05) \u2192 User: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e \u044d\u0442\u043e\" (10:06)\n\u2192 \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b = research \u2192 `copywriting` \u0441 source=research\n\n**F10: Multiple sent_messages**\n- System: Longread (10:00) \u2192 Research (10:05) \u2192 User: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u0440\u043e \u044d\u0442\u043e\" (10:06)\n\u2192 \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 sent_message = research (10:05) \u2192 `copywriting` \u0441 source=research\n\n**\u0422\u0432\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:** \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u2014 \"\u043f\u0440\u043e \u044d\u0442\u043e\" \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438\n\n---\n\n## IMPLICIT CONTEXT (pending_photo, pending_forwarded)\n\n**\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:** \u041a\u043e\u043c\u0430\u043d\u0434\u044b /stop \u0438 /start \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0414\u041e \u0442\u0435\u0431\u044f \u0438 \u043e\u0447\u0438\u0449\u0430\u044e\u0442 implicit context (\u0442\u044b \u0438\u0445 \u043d\u0435 \u0432\u0438\u0434\u0438\u0448\u044c).\n\n### \u041e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0418\u0413\u041d\u041e\u0420\u0418\u0420\u041e\u0412\u0410\u0422\u042c implicit context):\n- \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 URL: \"https://apple.com \u043d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442\"\n- \u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f: \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u043e\u0441\u0442 \u043e \u043d\u043e\u0432\u043e\u043c iPhone\"\n- \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f: \"\u041d\u0430\u0440\u0438\u0441\u0443\u0439 \u0440\u043e\u0431\u043e\u0442\u0430\", \"\u0421\u043e\u0437\u0434\u0430\u0439 \u0432\u0438\u0434\u0435\u043e\"\n\n### \u041d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0418\u0421\u041f\u041e\u041b\u042c\u0417\u041e\u0412\u0410\u0422\u042c implicit context + temporal proximity):\n- \u041c\u0435\u0441\u0442\u043e\u0438\u043c\u0435\u043d\u0438\u044f: \"\u0423\u0431\u0435\u0440\u0438 \u044d\u0442\u043e\", \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c\"\n- \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430: \"\u0423\u0431\u0435\u0440\u0438 \u0444\u043e\u043d\", \"\u0418\u0437\u043c\u0435\u043d\u0438 \u0446\u0432\u0435\u0442\"\n\n**\u0415\u0441\u043b\u0438 pending_photo \u0418 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u0435\u043d:**\n\u2192 `department = image_edit`, `intent = new_task`\n\n**\u0415\u0441\u043b\u0438 pending_forwarded \u0418 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u0435\u043d:**\n\u2192 `department = copywriting` \u0438\u043b\u0438 `research` (\u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443), `intent = new_task`\n\n**\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 pending:** \u0412\u044b\u0431\u0438\u0440\u0430\u0439 \u043f\u043e timestamp (\u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u043e\u0437\u0436\u0435)\n\n**\u0415\u0441\u043b\u0438 pending + sent_messages:** \u0412\u044b\u0431\u0438\u0440\u0430\u0439 \u043f\u043e timestamp (\u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 - \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b)\n\n\u041f\u0440\u0438\u043c\u0435\u0440\u044b:\n- \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c\" + forwarded (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435) \u2192 copywriting\n- \"\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0439 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443\" + forwarded (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435) \u2192 research\n- \"\u041d\u0430\u043f\u0438\u0448\u0438 \u043f\u0440\u043e \u044d\u0442\u043e\" + sent_messages research (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b) \u2192 copywriting \u0441 source\n\n---\n\n## VISUAL CONTENT RULES\n\n### IMAGE_EDIT (\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e)\n\n**Iterative cycles (\u0411\u0415\u0417 \u0444\u043e\u0442\u043e, \u0411\u0415\u0417 reply):**\n- \u0415\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c `completed` (department=image_edit, v1 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d)\n- **\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c task_update \u0434\u043b\u044f:**\n  - \u2705 \u041f\u043e\u043b\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438: \"\u0414\u043e\u0431\u0430\u0432\u044c \u043a\u043e\u0442\u0430 \u0441\u043b\u0435\u0432\u0430\", \"\u0423\u0431\u0435\u0440\u0438 \u0441\u0438\u043d\u0438\u0439 \u0444\u043e\u043d\"\n  - \u2705 \u041e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: \"\u0423\u0431\u0435\u0440\u0438 \u0444\u043e\u043d\", \"\u0421\u0434\u0435\u043b\u0430\u0439 \u044f\u0440\u0447\u0435\", \"\u0418\u0437\u043c\u0435\u043d\u0438 \u0446\u0432\u0435\u0442\"\n  - **\u041f\u0440\u0438\u0447\u0438\u043d\u0430:** \u0410\u0433\u0435\u043d\u0442 \u0412\u0418\u0414\u0418\u0422 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0447\u0435\u0440\u0435\u0437 `versions` \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0437\u043d\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\n  \n- **\u041d\u0415 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 task_update \u0434\u043b\u044f:**\n  - \u274c \u0421\u043e\u0432\u0441\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435: \"\u0421\u0434\u0435\u043b\u0430\u0439\", \"\u0425\u043c...\", \"\u0410 \u043c\u043e\u0436\u043d\u043e?\"\n  - \u274c \u041d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0435: \"\u0414\u043e\u0431\u0430\u0432\u044c \u044d\u0442\u043e\" (\u0447\u0442\u043e \"\u044d\u0442\u043e\"?)\n  \n\u2192 `intent = task_update`\n\n**\u041f\u0440\u0438\u043c\u0435\u0440\u044b:**\n- \"\u0423\u0431\u0435\u0440\u0438 \u0444\u043e\u043d\" (completed: image_edit v1) \u2192 task_update \u2705\n- \"\u0421\u0434\u0435\u043b\u0430\u0439 \u044f\u0440\u0447\u0435\" (completed: image_edit v1) \u2192 task_update \u2705\n- \"\u0414\u043e\u0431\u0430\u0432\u044c \u043a\u043e\u0442\u0430\" (completed: image_edit v1) \u2192 task_update \u2705\n- \"\u0421\u0434\u0435\u043b\u0430\u0439\" (completed: image_edit v1) \u2192 dialogue \u274c\n\n### IMAGE_GEN (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430)\n\n**Iterative cycles (\u0411\u0415\u0417 \u0444\u043e\u0442\u043e, \u0411\u0415\u0417 reply):**\n- \u0415\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c `completed` (department=image_gen, v1 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d)\n- **\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c task_update \u0434\u043b\u044f:**\n  - \u2705 \u041f\u043e\u043b\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438: \"\u0421\u0434\u0435\u043b\u0430\u0439 \u0440\u043e\u0431\u043e\u0442\u0430 \u0437\u0435\u043b\u0451\u043d\u044b\u043c\", \"\u0414\u043e\u0431\u0430\u0432\u044c \u0442\u0435\u043a\u0441\u0442 'Hello'\"\n  - \u2705 \u041e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: \"\u0421\u0434\u0435\u043b\u0430\u0439 \u044f\u0440\u0447\u0435\", \"\u0418\u0437\u043c\u0435\u043d\u0438 \u0441\u0442\u0438\u043b\u044c\"\n  - **\u041f\u0440\u0438\u0447\u0438\u043d\u0430:** \u0410\u0433\u0435\u043d\u0442 \u0412\u0418\u0414\u0418\u0422 previous_prompt \u0447\u0435\u0440\u0435\u0437 `versions` \u043c\u0430\u0441\u0441\u0438\u0432\n  \n- **\u041d\u0415 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 task_update \u0434\u043b\u044f:**\n  - \u274c \u0421\u043e\u0432\u0441\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435: \"\u0421\u0434\u0435\u043b\u0430\u0439\", \"\u0418\u0437\u043c\u0435\u043d\u0438\"\n  - \u274c \u041d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0435: \"\u0414\u043e\u0431\u0430\u0432\u044c \u0442\u0435\u043a\u0441\u0442\" (\u043a\u0430\u043a\u043e\u0439 \u0442\u0435\u043a\u0441\u0442?)\n\n\u2192 `intent = task_update`\n\n**\u041f\u0440\u0438\u043c\u0435\u0440\u044b:**\n- \"\u0421\u0434\u0435\u043b\u0430\u0439 \u0440\u043e\u0431\u043e\u0442\u0430 \u0437\u0435\u043b\u0451\u043d\u044b\u043c\" (completed: image_gen v1) \u2192 task_update \u2705\n- \"\u0421\u0434\u0435\u043b\u0430\u0439 \u044f\u0440\u0447\u0435\" (completed: image_gen v1) \u2192 task_update \u2705\n- \"\u0418\u0437\u043c\u0435\u043d\u0438 \u0441\u0442\u0438\u043b\u044c \u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0437\u043c\" (completed: image_gen v1) \u2192 task_update \u2705\n- \"\u0421\u0434\u0435\u043b\u0430\u0439\" (completed: image_gen v1) \u2192 dialogue \u274c\n\n### VIDEO_GEN (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e)\n\n**Iterative cycles (\u0411\u0415\u0417 reply):**\n- \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e IMAGE_GEN\n- \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: \"\u0421\u0434\u0435\u043b\u0430\u0439 \u0431\u044b\u0441\u0442\u0440\u0435\u0435\", \"\u0414\u043e\u0431\u0430\u0432\u044c \u043c\u0443\u0437\u044b\u043a\u0443\"\n- \u041d\u0415 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435: \"\u0421\u0434\u0435\u043b\u0430\u0439\", \"\u0418\u0437\u043c\u0435\u043d\u0438\"\n---\n\n## RESEARCH RULES (\u0432\u0430\u0436\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435)\n\n**\u041a\u0420\u0418\u0422\u0418\u0427\u0415\u0421\u041a\u0418 \u0412\u0410\u0416\u041d\u041e:** Research \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u041d\u0415 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.\n\n### \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0441 research:\n\n**Completed research + \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u04

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

How this works

This workflow harnesses AI to classify and contextualise Telegram messages, automatically pulling in relevant details like active tasks and conversation history to provide smarter, more informed responses. It's ideal for developers or teams managing Telegram bots, such as customer support or project trackers, who want to reduce manual oversight and enhance automation efficiency. The key step involves merging Telegram inputs with Supabase-stored data before feeding it into an AI agent for precise classification, ensuring outputs are structured and actionable without overwhelming the system.

Use this workflow when handling event-driven Telegram interactions that require context-aware decisions, like sorting user queries into tasks or replies. Avoid it for high-volume, real-time chats where latency from AI processing could frustrate users, or if your setup lacks Supabase for data storage. Common variations include adapting the prompt for sentiment analysis instead of classification, or integrating additional HTTP requests to fetch external APIs for richer context.

About this workflow

[HUB] Жора AI Classifier. Uses executeWorkflowTrigger, httpRequest, supabase, telegram. Event-driven trigger; 14 nodes.

Source: https://github.com/mike-prokhorov/n8n-automation-templates/blob/main/n8n-multi-agent-orchestrator/workflows/02_ai_classifier.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

6_Multi-Agent_4vaEvzlaMrgovhNz. Uses postgres, httpRequest, lmChatOpenAi, outputParserStructured. Event-driven trigger; 54 nodes.

Postgres, HTTP Request, OpenAI Chat +4
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Output Parser Structured, Telegram, N8N Nodes Tesseractjs +14
AI & RAG

Pitch Paul. Uses lmChatOpenRouter, telegram, outputParserStructured, supabaseTool. Event-driven trigger; 33 nodes.

OpenRouter Chat, Telegram, Output Parser Structured +10
AI & RAG

Automated Research Report Generation with OpenAI, Wikipedia, Google Search, and Gmail/Telegram. Uses lmChatOpenAi, memoryBufferWindow, toolHttpRequest, agent. Event-driven trigger; 26 nodes.

OpenAI Chat, Memory Buffer Window, Tool Http Request +8
AI & RAG

This workflow automates the process of generating professional research reports for researchers, students, and professionals. It eliminates manual research and report formatting by aggregating data, g

OpenAI Chat, Memory Buffer Window, Tool Http Request +8