task-status

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Task Status Skill

任务状态Skill

Quick Start

快速开始

Manual Status Updates

手动状态更新

bash
python scripts/send_status.py "Starting data fetch..." "progress" "step1"
python scripts/send_status.py "Processing complete" "success" "final"
python scripts/send_status.py "Error: Missing API key" "error" "auth"
bash
python scripts/send_status.py "Starting data fetch..." "progress" "step1"
python scripts/send_status.py "Processing complete" "success" "final"
python scripts/send_status.py "Error: Missing API key" "error" "auth"

Automatic Periodic Monitoring (Every 5 seconds)

自动定期监控(每5秒一次)

bash
undefined
bash
undefined

Start monitoring a long-running task

启动对长时间运行任务的监控

python scripts/monitor_task.py start "My Long Task" "processing"
python scripts/monitor_task.py start "My Long Task" "processing"

Monitor will send "Still working..." updates every 5 seconds

监控将每5秒发送一次“Still working...”更新

When task completes, report final status

任务完成后,报告最终状态

python scripts/monitor_task.py stop "My Long Task" "success" "Completed successfully!"
undefined
python scripts/monitor_task.py stop "My Long Task" "success" "Completed successfully!"
undefined

Status Types

状态类型

  • progress: Ongoing work (shows 🔄 or ->)
  • success: Task complete (shows ✅ or OK)
  • error: Failed task (shows ❌ or !)
  • warning: Issue but continuing (shows ⚠️ or ?)
  • progress:进行中的工作(显示🔄或->)
  • success:任务完成(显示✅或OK)
  • error:任务失败(显示❌或!)
  • warning:存在问题但仍在继续(显示⚠️或?)

Periodic Monitoring

定期监控

The
monitor_task.py
script provides automatic updates:
monitor_task.py
脚本提供自动更新功能:

Starting Monitor

启动监控

bash
python scripts/monitor_task.py start "<task_name>" "<status_type>" [--interval <seconds>]
  • Automatically sends "Still working..." updates every 5 seconds
  • Runs in background until stopped
  • Can be customized with different intervals
bash
python scripts/monitor_task.py start "<task_name>" "<status_type>" [--interval <seconds>]
  • 每5秒自动发送“Still working...”更新
  • 在后台运行直到停止
  • 可自定义不同的时间间隔

Stopping Monitor

停止监控

bash
python scripts/monitor_task.py stop "<task_name>" "<final_status>" "<final_message>"
bash
python scripts/monitor_task.py stop "<task_name>" "<final_status>" "<final_message>"

Example: Long File Processing

示例:长文件处理

bash
undefined
bash
undefined

Start monitoring

启动监控

python scripts/monitor_task.py start "video_processing" "progress"
python scripts/monitor_task.py start "video_processing" "progress"

... long processing happens here ...

... 此处执行长时间处理 ...

Stop with final status

停止并发送最终状态

python scripts/monitor_task.py stop "video_processing" "success" "Processing complete!"
undefined
python scripts/monitor_task.py stop "video_processing" "success" "Processing complete!"
undefined

Manual Updates (Quick Status)

手动更新(快速状态)

For single status updates without monitoring:
bash
python scripts/send_status.py "Still fetching data..." "progress" "fetch"
python scripts/send_status.py "Processing records: 250/1000" "progress" "process"
python scripts/send_status.py "Complete! 3 files ready" "success" "final"
python scripts/send_status.py "Error: Connection timeout" "error" "api"
适用于无需监控的单次状态更新:
bash
python scripts/send_status.py "Still fetching data..." "progress" "fetch"
python scripts/send_status.py "Processing records: 250/1000" "progress" "process"
python scripts/send_status.py "Complete! 3 files ready" "success" "final"
python scripts/send_status.py "Error: Connection timeout" "error" "api"

When to Use Each Method

各方法适用场景

Use Manual Updates When:

适用手动更新的场景:

  • Task is short (under 30 seconds)
  • You want control over when updates are sent
  • Task has discrete, meaningful milestones
  • 任务耗时较短(30秒以内)
  • 你希望控制更新发送的时机
  • 任务有明确、有意义的里程碑

Use Periodic Monitoring When:

适用定期监控的场景:

  • Task is long-running (over 1 minute)
  • You want consistent "heartbeat" updates every 5 seconds
  • Task has long periods of quiet work
  • You want to reassure user that work is ongoing
  • 任务长时间运行(超过1分钟)
  • 你需要每5秒发送一致的“心跳”更新
  • 任务存在长时间无输出的阶段
  • 你需要向用户确认任务仍在进行中

Message Guidelines

消息指南

Keep status messages under 140 characters. Examples:
  • Progress: "Still fetching data..." or "Processing records: 250/1000"
  • Success: "Complete! 3 files ready" or "Task finished successfully"
  • Error: "Error: Connection timeout" or "Failed: Missing API key"
  • Warning: "Continuing despite timeout" or "Partial success: 5/10 files"
状态消息请控制在140字符以内。示例:
  • 进度:“Still fetching data...” 或 “Processing records: 250/1000”
  • 成功:“Complete! 3 files ready” 或 “Task finished successfully”
  • 错误:“Error: Connection timeout” 或 “Failed: Missing API key”
  • 警告:“Continuing despite timeout” 或 “Partial success: 5/10 files”

Advanced Usage

高级用法

With Additional Details

添加额外详情

bash
python scripts/send_status.py "Uploading..." "progress" "upload" --details "File: report.pdf (2.4MB)"
bash
python scripts/send_status.py "Uploading..." "progress" "upload" --details "File: report.pdf (2.4MB)"

Different Intervals

自定义时间间隔

bash
python scripts/monitor_task.py start "data_sync" "progress" --interval 10
bash
python scripts/monitor_task.py start "data_sync" "progress" --interval 10

Importing for Python Scripts

在Python脚本中导入使用

python
from send_status import send_status

def long_task():
    send_status("Starting...", "progress", "step1")
    # ... work
    send_status("Step complete", "success", "step1")
python
from send_status import send_status

def long_task():
    send_status("Starting...", "progress", "step1")
    # ... 执行任务 ...
    send_status("Step complete", "success", "step1")

Automation with Clawdbot Cron

与Clawdbot Cron结合实现自动化

For scheduled tasks, use Clawdbot's cron feature:
python
undefined
对于定时任务,可使用Clawdbot的cron功能:
python
undefined

In a script or session

在脚本或会话中

from cron import add
from cron import add

Every 5 seconds, check status

每5秒检查一次状态更新

job = { "text": "Check status update", "interval": "5s", "enabled": True } add(job)

This allows status updates even when you're not actively watching.
job = { "text": "Check status update", "interval": "5s", "enabled": True } add(job)

这样即使你没有主动关注,也能发送状态更新。

Installation

安装

To use this skill, copy the
task-status
folder into your Clawdbot skills directory:
C:\Users\Luffy\AppData\Roaming\npm\node_modules\clawdbot\skills\task-status
Or add it to your workspace and reference it from
AGENTS.md
or
TOOLS.md
.
Once installed, the skill will be available for any task where you need periodic status updates.
要使用此Skill,请将
task-status
文件夹复制到你的Clawdbot技能目录:
C:\Users\Luffy\AppData\Roaming\npm\node_modules\clawdbot\skills\task-status
或者将其添加到你的工作区,并在
AGENTS.md
TOOLS.md
中引用。
安装完成后,该Skill将可用于所有需要定期状态更新的任务。