task-dispatch
by cccaptain0129
Task scheduling and dispatching for task boards. Use when setting up periodic task dispatch, checking for dispatchable tasks, creating subagents to execute tasks, or verifying task completion. Supports task board APIs like ClawBoard.
安装
claude skill add --url https://github.com/openclaw/skills文档
Task Dispatch
Automated task scheduling and execution for task management systems.
Quick Start
用户说"设置任务调度"或"部署 ClawBoard"时,按以下流程引导:
Step 1: 检测环境
# 检查 Node.js
node --version # 需要 >= 18
# 检查 ClawBoard 是否已安装
ls -la ~/ClawBoard 2>/dev/null || echo "ClawBoard not installed"
Step 2: 部署 ClawBoard(如未安装)
# 克隆仓库
git clone https://github.com/CCCaptain0129/ClawBoard.git ~/ClawBoard
cd ~/ClawBoard
# 安装依赖并初始化
./clawboard install
# 生成访问 token(自动保存到 .env)
./clawboard token --generate
Step 3: 启动服务
cd ~/ClawBoard
./clawboard start
# 检查状态
./clawboard status
Step 4: 配置 Agent 环境
在 Agent 工作目录创建 .env 文件:
# 获取 token
TOKEN=$(cat ~/ClawBoard/.env | grep BOARD_ACCESS_TOKEN | cut -d= -f2)
# 写入 Agent 工作目录
echo "TASKBOARD_API_URL=http://127.0.0.1:3000" >> ~/.openclaw/workspace-<name>/.env
echo "TASKBOARD_ACCESS_TOKEN=$TOKEN" >> ~/.openclaw/workspace-<name>/.env
Step 5: 打开看板
- 前端看板: http://127.0.0.1:5173
- 后端 API: http://127.0.0.1:3000
- 输入
.env中的BOARD_ACCESS_TOKEN登录
Step 6: 设置定时调度(可选)
用户说"设置定时调度"时:
{
"name": "ClawBoard 调度巡检",
"schedule": { "kind": "every", "everyMs": 300000 },
"payload": {
"kind": "agentTurn",
"message": "执行 task-dispatch 调度检查。无任务时返回 HEARTBEAT_OK。"
},
"sessionTarget": "isolated",
"delivery": { "mode": "none" }
}
Agent Role
You are a dispatcher, not an executor.
- Your job: plan, dispatch, verify, update status
- NOT your job: implement tasks yourself
- Task execution: delegated to subagents
- You verify results and update task status
Data Source of Truth
| What | Source |
|---|---|
| Task data | API endpoint (e.g., http://127.0.0.1:3000/api/tasks/...) |
| Task files | tasks/*.json (written by API) |
| Project docs | projects/<project-name>/docs/ |
| NOT source of truth | Frontend dashboard (view only) |
ClawBoard Deployment Guide
Prerequisites
- Node.js >= 18
- Git
- PM2 (auto-installed by
./clawboard install)
Installation Commands
| Command | Description |
|---|---|
./clawboard install | Install dependencies, create .env |
./clawboard start | Start frontend + backend services |
./clawboard stop | Stop all services |
./clawboard status | Check service health |
./clawboard token | Show current access token |
./clawboard token --generate | Generate new token |
Verification Checklist
After deployment, verify:
- ✅ Backend API responds:
curl http://127.0.0.1:3000/health - ✅ Frontend loads: open http://127.0.0.1:5173
- ✅ Token works:
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:3000/api/tasks/projects - ✅ Agent .env configured with token
Common Issues
| Issue | Solution |
|---|---|
| Port 3000 in use | lsof -i :3000 then kill process |
| Port 5173 in use | lsof -i :5173 then kill process |
| Token not working | Regenerate with ./clawboard token --generate |
| Services not starting | Check logs in ~/ClawBoard/logs/ |
Dispatch Operations
Overview
This skill enables agents to:
- Check task boards for dispatchable tasks
- Spawn subagents to execute tasks
- Verify completion and update task status
- Continue dispatching until no tasks remain (no waiting for next cron)
Key Principle: Continuous Dispatch
触发一次 → 循环执行直到无任务 → 结束
而不是:
触发一次 → 派发一个任务 → 等待下次触发
Dispatch Loop
def dispatch_loop():
while True:
task = select_dispatchable_task()
if not task:
return HEARTBEAT_OK # 本轮结束
# 派发并等待完成
result = spawn_and_wait(task)
# 验收
if result.success:
update_task(task.id, status="review")
else:
update_task(task.id, status="failed", blockingReason=result.error)
# 【关键】立即继续下一轮,不返回
# 循环会自动检查下一个任务
API Reference
Get Projects
GET {TASKBOARD_API_URL}/api/tasks/projects
Authorization: Bearer {TOKEN}
Get Tasks
GET {TASKBOARD_API_URL}/api/tasks/projects/{projectId}/tasks
Authorization: Bearer {TOKEN}
Create Project
POST {TASKBOARD_API_URL}/api/tasks/projects
Authorization: Bearer {TOKEN}
Content-Type: application/json
{
"id": "my-project",
"name": "My Project",
"description": "...",
"taskPrefix": "MP",
"color": "#3B82F6",
"icon": "📁"
}
Create Task
POST {TASKBOARD_API_URL}/api/tasks/projects/{projectId}/tasks
Authorization: Bearer {TOKEN}
Content-Type: application/json
{
"title": "Task title",
"description": "...",
"status": "todo",
"priority": "P1",
"executionMode": "auto",
"assignee": "agent-id"
}
Update Task
PUT {TASKBOARD_API_URL}/api/tasks/projects/{projectId}/tasks/{taskId}
Authorization: Bearer {TOKEN}
Content-Type: application/json
{
"status": "in-progress",
"claimedBy": "agent-id"
}
Task Selection Rules
A task is dispatchable if ALL conditions are met:
| Condition | Requirement |
|---|---|
executionMode | "auto" |
status | "todo" or "in-progress" (unclaimed) |
assignee | Empty or null |
claimedBy | Empty or null |
dependencies | All have status: "done" |
Priority Order
P0>P1>P2>P3- Same priority: earlier
createdAtfirst
Subagent Execution
Prepare Dispatch Context
Before spawning subagent, prepare context using the Dispatch Template:
See references/dispatch-template.md for full template.
Required fields to fill:
- Task Identity (from task data)
- Goal (one sentence)
- Hard Constraints (what NOT to do)
- Deliverables (from task.deliverables)
- Acceptance Criteria (from task.acceptanceCriteria)
- Output Format (completion_signal block)
Spawn with Wait
Use sessions_spawn with the dispatch context:
{
"runtime": "subagent",
"mode": "run",
"task": "<filled dispatch template>",
"timeoutSeconds": 300
}
The main agent should:
- Fill dispatch template with task context
- Spawn subagent with the template
- Wait for completion (blocking or polling)
- Parse
completion_signalfrom response - Verify deliverables and update status
- Immediately continue to next task
Completion Signal
Subagent must return a completion_signal block:
task_id: <taskId>
status: done | blocked
summary: <one sentence summary>
deliverables: <comma-separated paths>
next_step: <N/A if done; blocking reason if blocked>
Parse this block to determine task outcome:
status: done→ Verify deliverables, update toreviewstatus: blocked→ Update tofailedwithblockingReason
Status Transitions
todo → in-progress → review → done
↓ ↓
failed failed
Important: Tasks go to review after subagent completes, not directly to done. User or main agent verifies before done.
Verification Checklist
After subagent completes, verify:
-
Deliverables exist
- Check all paths in
deliverablesarray - Files should be non-empty
- Check all paths in
-
Acceptance criteria met
- Review each criterion
- Mark pass/fail
-
Update status
- All pass →
review - Any fail →
failedwithblockingReason
- All pass →
Heartbeat Response
When triggered by cron/heartbeat:
- No dispatchable tasks: Return
HEARTBEAT_OK(silent, no message to user) - Tasks dispatched: Report results, then check for more
- Continue until empty: Don't stop after one task
Failure Handling
When a task fails or has no valid execution:
- Record the reason in
blockingReasonfield - Clear invalid occupation (
claimedBy) - Return task to actionable state (
todoorin-progress) - Never fail silently - always log or report
Common Failure Scenarios
| Scenario | Action |
|---|---|
| Subagent timeout | Set failed, clear claimedBy, log reason |
Subagent returns blocked | Set failed with blockingReason |
| Deliverables missing | Set failed, clear claimedBy |
| API error | Log error, skip this round, try next time |
Dispatch Principles
- Only dispatch
executionMode=autotasks - Priority order:
todofirst, then unclaimedin-progress - Respect assignee: Don't re-dispatch if
assigneeis set - Verify before done: Tasks go to
reviewfirst, thendoneafter verification
Configuration
See references/config.md for:
- Task board adapters
- Priority mappings
- Execution timeouts
- Retry policies
Example Usage
Deploy ClawBoard
"部署 ClawBoard 看板"
Setup with User Guidance
"帮我设置任务调度系统"
Manual Dispatch (runs until empty)
"检查任务看板,派发所有待执行任务"
Setup Periodic Check
"设置每10分钟自动检查任务"
The cron will trigger the dispatch loop, which runs until no tasks remain.
相关 Skills
技能工坊
by anthropics
覆盖 Skill 从创建到迭代优化全流程:起草能力、补测试提示、跑评测与基准方差分析,并持续改写内容和描述,提升效果与触发准确率。
✎ 技能工坊把技能从创建、迭代到评测串成闭环,方差分析加描述优化,特别适合把触发准确率打磨得更稳。
表格处理
by anthropics
围绕 .xlsx、.xlsm、.csv、.tsv 做读写、修复、清洗、格式整理、公式计算与格式转换,适合修改现有表格、生成新报表或把杂乱数据整理成交付级电子表格。
✎ 做 Excel/CSV 相关任务很省心,能直接读写、修复、清洗和格式转换,尤其擅长把乱七八糟的表格整理成交付级文件。
PDF处理
by anthropics
遇到 PDF 读写、文本表格提取、合并拆分、旋转加水印、表单填写或加解密时直接用它,也能提取图片、生成新 PDF,并把扫描件通过 OCR 变成可搜索文档。
✎ PDF杂活别再来回切工具了,文本表格提取、合并拆分到OCR识别一次搞定,连扫描件也能变可搜索。
相关 MCP 服务
文件系统
编辑精选by Anthropic
Filesystem 是 MCP 官方参考服务器,让 LLM 安全读写本地文件系统。
✎ 这个服务器解决了让 Claude 直接操作本地文件的痛点,比如自动整理文档或生成代码文件。适合需要自动化文件处理的开发者,但注意它只是参考实现,生产环境需自行加固安全。
by wonderwhy-er
Desktop Commander 是让 AI 直接执行终端命令、管理文件和进程的 MCP 服务器。
✎ 这工具解决了 AI 无法直接操作本地环境的痛点,适合需要自动化脚本调试或文件批量处理的开发者。它能让你用自然语言指挥终端,但权限控制需谨慎,毕竟让 AI 执行 rm -rf 可不是闹着玩的。
EdgarTools
编辑精选by dgunning
EdgarTools 是无需 API 密钥即可解析 SEC EDGAR 财报的开源 Python 库。
✎ 这个工具解决了金融数据获取的痛点——直接让 AI 读取结构化财报,比如让 Claude 分析苹果的 10-K 文件。适合量化分析师或金融开发者快速构建数据管道。但注意,它依赖 SEC 网站稳定性,高峰期可能延迟。