Community程式設計與開發github.com

TaskFlow 收件匣分類處理

一個示範如何在收件匣分類、意圖路由、等待回覆及後續摘要中使用 TaskFlow 架構的具體範例。

TaskFlow 收件匣分類處理 是什麼?

這個技能示範了如何使用 TaskFlow 模式實現收件匣分類的完整流程,而無需將核心運行時轉變為 DSL。它定義了三種處理策略:商業相關項目會發布至 Slack 並等待回覆;個人項目會立即通知使用者;其他項目則保留至每日結束時進行摘要。該模式將流程狀態保存在 `stateJson` 中,並在需要外部回覆時進入 `waiting` 狀態,並透過 `resume` API 恢復流程。支援的平臺包括任何實作 TaskFlow 運行的系統(如 ACP 運行時),並透過 TypeScript API 呼叫來管理流程生命週期,適合開發者實現自動化的訊息分類與處理代理。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/taskflow-inbox-triage

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

TaskFlow 收件匣分類處理 是做什麼的?

這是一個具體範例,說明如何在不將核心運行時轉變為 DSL 的前提下思考 TaskFlow。

目標

使用單一擁有者流程處理收件匣項目:

  • 商業相關 -> 發佈至 Slack 並等待回覆
  • 個人相關 -> 立即通知擁有者
  • 其他所有項目 -> 保留至每日結束摘要

模式

  1. 為收件匣批次建立一個流程。
  2. 執行一個獨立的任務來分類新項目。
  3. 將路由狀態儲存在 stateJson 中。
  4. 僅在需要外部回覆時才進入 waiting 狀態。
  5. 當分類完成或取得人類輸入後,恢復流程。
  6. 當批次完成路由後結束流程。

建議的 stateJson 結構

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

建議的 waitJson(當卡在 Slack 回覆時):

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

最小運行時呼叫

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,
});

相關範例

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

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相關技能