← 返回
沟通协作 中文

Task Watcher Skill

Monitor async tasks by polling their state and send Discord/Telegram notifications on changes or completion for workflows like CI/CD, deployments, or reviews.
通过轮询监控异步任务状态,在 CI/CD、部署、审查等流程变更或完成时发送 Discord/Telegram 通知。
lanyasheng
沟通协作 clawhub v1.2.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 595
下载
💾 8
安装
1
版本
#async#automation#callback#latest#monitoring

概述

task-watcher — Async Task Monitoring & Callback

> Version: 1.2.0

> Author: sly (OpenClaw)

> License: MIT

> Install: clawhub install task-watcher

Monitor long-running async tasks (content review, CI/CD, deployments) and get Discord/Telegram notifications when states change.

What It Does

Register tasks → Watcher polls for state changes → Sends notifications on change/completion.

Perfect for:

  • Content publishing: Monitor XHS/社媒 review status after posting
  • CI/CD: Track GitHub PR merges, build completions
  • Deployments: Watch rollout status
  • Any async workflow: Anything that takes time and you want to know when it's done

Architecture

Agent registers task → tasks.jsonl (shared-context)
                            ↓
Cron (*/3 * * * *) → watcher.py → Adapter checks state → state changed?
                                                              ↓ Yes
                                              Policy decides → Notifier sends Discord

Plugin architecture:

  • Adapters: Pluggable state checkers. Built-in: XHS, GitHub PR, Cron Job
  • Notifiers: Discord (via openclaw agent --deliver), Telegram, Session, File
  • Policies: Notification frequency, escalation, retry logic
  • Stores: JSONL-based persistence with file locking
  • Protection: expires_at timeout (default 6h), 3x delivery failure escalation

Quick Start

1. Install

clawhub install task-watcher

2. Register a monitoring task

import sys, os
sys.path.insert(0, os.path.expanduser("~/.openclaw/workspace/skills/task-watcher/scripts/lib"))

from models import CallbackTask
from stores import JsonlTaskStore

store = JsonlTaskStore("~/.openclaw/shared-context/monitor-tasks/tasks.jsonl")
task = CallbackTask(
    task_id="tsk_my_task_001",
    owner_agent="content",
    target_system="xiaohongshu",
    target_object_id="note_id_here",
    reply_channel="discord",
    reply_to="channel:YOUR_CHANNEL_ID",
    current_state="submitted",
    expires_at="2026-03-08T12:00:00",  # 6h timeout recommended
)
store.create(task)

Or via CLI:

cd ~/.openclaw/workspace/skills/task-watcher
python3 scripts/register_task.py \
  --task-id tsk_my_001 \
  --system xiaohongshu \
  --object-id note_abc123 \
  --reply-to channel:1234567890 \
  --expires-hours 6

3. Run watcher (cron)

# Add to crontab - every 3 minutes
*/3 * * * * cd ~/.openclaw/workspace/skills/task-watcher && \
  python3 scripts/watcher.py --once >> ~/.openclaw/logs/watcher.log 2>&1

4. Custom adapter

from adapters import StateAdapter, StateResult

class MyAdapter(StateAdapter):
    @property
    def name(self): return "my-system"
    
    def supports(self, task): return task.target_system == "my-system"
    def health_check(self): return True
    
    def check(self, task):
        status = check_my_system(task.target_object_id)
        return StateResult(state=status, terminal=(status == "done"))

File Structure

task-watcher/
├── SKILL.md                    # This file
├── _meta.json                  # ClawHub metadata
├── scripts/
│   ├── watcher.py              # Cron entry point
│   ├── register_task.py        # CLI task registration
│   └── lib/
│       ├── __init__.py         # Package exports
│       ├── models.py           # Data models (CallbackTask, StateResult, SendResult)
│       ├── stores.py           # JSONL TaskStore with file locking
│       ├── adapters.py         # State adapters (XHS, GitHub, Cron)
│       ├── notifiers.py        # Discord/Telegram/File notifiers
│       ├── policies.py         # Notification policies
│       └── bus.py              # WatcherBus orchestrator
└── tests/
    ├── test_models.py
    ├── test_stores.py
    ├── test_adapters.py
    ├── test_notifiers.py
    ├── test_policies.py
    └── test_bus.py

Data Paths

FilePurpose
---------------
~/.openclaw/shared-context/monitor-tasks/tasks.jsonlActive tasks
~/.openclaw/shared-context/monitor-tasks/audit.logAudit trail
~/.openclaw/shared-context/monitor-tasks/notifications/Notification files

Built-in Adapters

AdapterSystemHow It Checks
--------------------------------
xiaohongshu-note-reviewXHS content reviewMock file / packet file
github-pr-statusGitHub PR mergeSkeleton (extend for your use)
cron-job-completionCron job trackingFile-based status check

Requirements

  • Python 3.10+
  • OpenClaw 2026.3+ (for openclaw agent --deliver)
  • No external dependencies (stdlib only)

版本历史

共 1 个版本

  • v1.2.1 当前
    2026-03-30 13:12 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,587
content-creation

去 AI 味内容引擎

lanyasheng
为小红书、X、知乎等平台生成“去 AI 味”的内容重写与新稿产出技能。用于用户要求内容更像真人表达、减少模板腔、提升口语感和观点力度的场景;也用于把已有草稿改写为平台适配版本。触发词包括“去 AI 味”“重写成更像人写的”“太像 AI 了”
★ 15 📥 4,360
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,680