自动化中等风险

TaskFlow 收件箱分流

示例性的 TaskFlow 编排模式:按意图对收件箱消息进行分流,业务消息转 Slack 并等待回复,个人消息立即通知,其余汇总到日终摘要。

by @unknownv1.0.06 浏览3 下载
#agent#example#inbox-triage#orchestration#slack#taskflow#workflow
推荐方式

直接交给 AI

无需安装文件。复制一句话,让 AI 在线读取这个 Skill。

下载 Skill ZIP ↓ 查看 SKILL.md 原文 ↗
01

它能帮你做什么

先看懂,再决定要不要交给 AI。

本 Skill 提供一个具体的 TaskFlow 编排示例,演示如何在不把运行时变成 DSL 的前提下,对收件箱消息进行分流处理。其核心思路是创建一个托管的 flow,由一个 detached 任务对消息进行分类,分类状态保存在 stateJson 中;当需要等待外部回复(如 Slack 线程)时进入 waiting 状态,并在分类或人工输入完成后恢复 flow。典型的分流规则包括:业务类消息发布到 Slack 并等待回复;个人类消息立即通知所有者;其他消息则累积到日终汇总。文档中给出了建议的 stateJson 结构(businessThreads、personalItems、eodSummary)、Slack 阻塞时的 waitJson 结构,以及一组最小化的运行时调用示例(createManaged、runTask、setWaiting、resume、finish),并附带一个 Lobster 示例文件路径。

✓演示如何用 TaskFlow 编排一个收件箱分流流程
✓按意图(业务/个人/其他)对消息进行分类路由
✓在等待外部系统(如 Slack 线程回复)时挂起 flow 并在后续恢复
✓作为构建更复杂 Agent 编排模式的参考模板
02

怎么交给 AI

在线读取优先,本地安装作为备选。

◎
在线读取推荐 · 不需要安装

适合能访问网页的 ChatGPT、Agent 或其他 AI。

AI Prompt请访问 https://skills.dhmip.cn/skills/unknown/taskflow-inbox-triage/SKILL.md,读取并按照该 Skill 完成任务;如当前环境支持本地安装,也可以下载该 Skill。
↓
下载安装到 Agent适合支持 Skills 的客户端

未登录时可使用公共安装文档;登录后可以按不同 AI 分开管理。

Install Prompt请根据 https://skills.dhmip.cn/install/skillhub.md,安装 @unknown/taskflow-inbox-triage。
登录后管理多个 AI →
03

兼容性与要求

安装或使用前,先确认环境是否匹配。

适用客户端

unknown

使用要求

  • 依赖支持 TaskFlow 编排的运行时/插件环境(示例中提及 api.runtime.tasks.flow)
  • 需要提供 tool context (ctx) 以便构造 taskFlow 句柄
  • 需要 ACP 运行时及子会话(示例使用 acp 与 agent:main:subagent:classifier)
  • 需要能够访问外部通道(例如 Slack)以投递业务消息并接收回复
  • 需要支持 stateJson 与 waitJson 的持久化与版本管理(expectedRevision)
⌘技术详情查看完整 SKILL.md 与原始内容
⌄
SKILL.mdRaw ↗

name: taskflow-inbox-triage
description: Example TaskFlow authoring pattern for inbox triage. Use when messages need different treatment based on intent, with some routes notifying immediately, some waiting on outside answers, and others rolling into a later summary.
metadata: { "openclaw": { "emoji": "📥" } }


TaskFlow inbox triage

This is a concrete example of how to think about TaskFlow without turning the core runtime into a DSL.

Goal

Triage inbox items with one owner flow:

  • business → post to Slack and wait for reply
  • personal → notify the owner now
  • everything else → keep for end-of-day summary

Pattern

  1. Create one flow for the inbox batch.
  2. Run one detached task to classify new items.
  3. Persist the routing state in stateJson.
  4. Move to waiting only when an outside reply is required.
  5. Resume the flow when classification or human input completes.
  6. Finish when the batch has been routed.

Suggested stateJson shape

{
  "businessThreads": [],
  "personalItems": [],
  "eodSummary": []
}

Suggested waitJson when blocked on Slack:

{
  "kind": "reply",
  "channel": "slack",
  "threadKey": "slack:thread-1"
}

Minimal runtime calls

const taskFlow = api.runtime.tasks.flow.fromToolContext(ctx);

const created = taskFlow.createManaged({
  controllerId: "my-plugin/inbox-triage",
  goal: "triage inbox",
  currentStep: "classify",
  stateJson: {
    businessThreads: [],
    personalItems: [],
    eodSummary: [],
  },
});

const child = taskFlow.runTask({
  flowId: created.flowId,
  runtime: "acp",
  childSessionKey: "agent:main:subagent:classifier",
  task: "Classify inbox messages",
  status: "running",
  startedAt: Date.now(),
  lastEventAt: Date.now(),
});

if (!child.created) {
  throw new Error(child.reason);
}

const waiting = taskFlow.setWaiting({
  flowId: created.flowId,
  expectedRevision: created.revision,
  currentStep: "await_business_reply",
  stateJson: {
    businessThreads: ["slack:thread-1"],
    personalItems: [],
    eodSummary: [],
  },
  waitJson: {
    kind: "reply",
    channel: "slack",
    threadKey: "slack:thread-1",
  },
});

if (!waiting.applied) {
  throw new Error(waiting.code);
}

const resumed = taskFlow.resume({
  flowId: waiting.flow.flowId,
  expectedRevision: waiting.flow.revision,
  status: "running",
  currentStep: "route_items",
  stateJson: waiting.flow.stateJson,
});

if (!resumed.applied) {
  throw new Error(resumed.code);
}

taskFlow.finish({
  flowId: resumed.flow.flowId,
  expectedRevision: resumed.flow.revision,
  stateJson: resumed.flow.stateJson,
});

Related example

  • skills/taskflow/examples/inbox-triage.lobster