Task Persistence for Openclaw

A robust task management system designed to ensure continuity, state persistence, and automated recovery for AI agents during long-running operations.

yangdaowan
v1.1.0
Mar 1, 2026
0
1.1k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install task-persistence

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install task-persistence using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Task Persistence?

The Task Persistence skill provides a critical infrastructure layer for maintaining agent state across restarts and complex, multi-step operations. By implementing a standardized persistence layer, it prevents progress loss during gateway interruptions or system cycles. This skill is essential for developers building reliable Openclaw Skills that need to handle asynchronous tasks or maintain a memory of active workflows.

At its core, the skill manages task registration, priority queuing, and session snapshotting. It allows the agent to "remember" exactly where it left off, providing a seamless user experience even when the underlying environment is reset. This makes it a foundational component for high-availability AI agent deployments.

Task Persistence Use Cases

  • Automatically resuming long-running file processing or data analysis tasks after a system reboot.
  • Tracking the status of multiple concurrent operations to provide users with progress updates.
  • Recovering lost session context through snapshots when an AI gateway restarts unexpectedly.
  • Organizing task queues by priority to ensure critical operations are completed first.
  • Auditing completed and failed tasks to maintain a historical record of agent activity.

How Task Persistence Works

  1. When starting a multi-step operation, the agent registers a new task with unique metadata via the task manager.
  2. The system creates a persistence record in the workspace, capturing task type, priority, and initial state.
  3. During execution, the agent periodically saves session snapshots to preserve environmental variables and context.
  4. Upon a gateway restart, the system runs a check-restart mode to identify any tasks that were interrupted.
  5. The agent analyzes the active task list and recovery files to resume work or report status to the user.

Task Persistence Setup

This skill requires python3 and an environment variable OPENCLAW_WORKSPACE (defaults to /workspace). No external dependencies are needed as it uses the Python standard library.

Initialize the recovery check after any restart:

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

Register a new task before starting long operations:

python3 {baseDir}/scripts/task_manager.py \
  --action add \
  --task-id "task_$(date +%s)" \
  --task-type "processing" \
  --priority normal \
  --workspace /workspace

Task Persistence Data Schema & Taxonomy

The skill maintains a structured directory within the workspace to ensure data integrity for Openclaw Skills:

Path Description
tasks/task_queue.json The primary queue for all registered tasks.
tasks/completed/ Storage for JSON files of successfully finished tasks.
memory/session_snapshots/ Directory containing serialized session state snapshots.
persistence/active_tasks.json Real-time tracking of tasks currently in progress.
persistence/gateway_state.json Metadata and heartbeat information for the gateway.

Task Persistence Advanced Features

  • Support for custom task types and metadata tagging for specialized workflows.
  • Automated session snapshotting to capture deep context beyond simple task IDs.
  • Priority-based execution logic to manage resource allocation in multi-task environments.
  • Detailed failure logging and task archival for debugging complex Openclaw Skills implementations.
  • Seamless integration with heartbeat monitors to detect and respond to environment crashes in real-time.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*