task-persistence

Task continuity, session snapshots, and gateway restart recovery. Use when starting long-running tasks (register them), after gateway restart (check for interrupted tasks), or when user asks about task status/recovery. Trigger on "resume", "任务恢复", "重启后", "未完成任务", or before/after any multi-step operation.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "task-persistence" with this command: npx skills add yangdaowan/task-persistence

Task Persistence

会话状态管理、任务持久化和网关重启恢复。

核心场景

触发条件动作
网关刚重启运行 check-restart,汇报恢复状态
开始长时间任务task_manager.py add 注册任务
用户问"有没有未完成的任务"运行 task_manager.py list
任务完成运行 task_manager.py complete
任务被中断运行 task_manager.py recover

变量说明

所有脚本中的 {baseDir} = 本技能的目录路径(SKILL.md 所在目录)。 工作区路径从环境变量 OPENCLAW_WORKSPACE 读取,默认 /workspace

快速命令

网关重启后检查(每次重启后必须执行)

python3 {baseDir}/scripts/main.py --mode check-restart --workspace /workspace

查看所有活跃任务

python3 {baseDir}/scripts/task_manager.py --action list --workspace /workspace

注册新任务(开始长时间操作前)

python3 {baseDir}/scripts/task_manager.py \
  --action add \
  --task-id "task_$(date +%s)" \
  --task-type "file_processing" \
  --description "处理大量文件" \
  --priority normal \
  --workspace /workspace

标记任务完成

python3 {baseDir}/scripts/task_manager.py \
  --action complete \
  --task-id <task_id> \
  --workspace /workspace

从崩溃/重启中恢复任务

python3 {baseDir}/scripts/task_manager.py \
  --action recover \
  --workspace /workspace

任务队列状态

python3 {baseDir}/scripts/task_manager.py --action status --workspace /workspace

会话快照(保存当前状态)

python3 {baseDir}/scripts/session_snapshot.py \
  --workspace /workspace \
  --action list

网关监控状态

python3 {baseDir}/scripts/main.py --mode status --workspace /workspace

重启后工作流

当 heartbeat 或用户提到"网关重启"时,执行:

  1. python3 {baseDir}/scripts/main.py --mode check-restart --workspace /workspace
  2. 解析输出中的 active_tasksrecovered_tasks
  3. 向用户汇报:哪些任务被恢复、哪些需要手动继续

文件结构

/workspace/
  tasks/
    task_queue.json       # 任务队列
    completed/            # 已完成任务
    failed/               # 失败任务
  memory/
    session_snapshots/    # 会话快照
  persistence/
    active_tasks.json     # 持久化任务
    gateway_state.json    # 网关状态

注意事项

  • 脚本使用标准库,无需额外安装依赖
  • 所有数据持久化在 workspace 目录下,重启后不会丢失
  • task_manager.py 是统一入口,推荐优先使用
  • gateway_monitor.py 的后台监控模式(full mode)在沙箱中不适用,用 check-restart 代替

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Power Automate Monitoring

**Pro+ subscription required.** Tenant-wide Power Automate flow health monitoring, failure rate analytics, and asset inventory using the FlowStudio MCP cache...

Registry SourceRecently Updated
General

Power Automate Governance

Govern Power Automate flows and Power Apps at scale using the FlowStudio MCP cached store. Classify flows by business impact, detect orphaned resources, audi...

Registry SourceRecently Updated
General

Secretary Memory

OpenClaw 秘书式多分区记忆系统 v3.0。仿生现代秘书的笔记本分类法,支持:(1) 多分区并发搜索 + 每分区3条上下文召回,(2) 会话自动摘要,(3) 偏好自动提取 + 用户关系图谱,(4) 记忆冲突主动检测,(5) 定时 consolidation + 会话结束 hook,(6) 精细化恢复/回溯,...

Registry SourceRecently Updated
General

运维助手 v2.0

运维助手 v2.0 - 支持本地、远程、多服务器集群监控 (健康检查、日志分析、性能监控、批量操作、文件传输)

Registry SourceRecently Updated