Context Cleanup for Openclaw

A utility designed to organize workspace memory logs and reduce redundant context for AI agents.

irideas
v0.2.1
Mar 6, 2026
0
888
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install bobo-context-cleanup

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 bobo-context-cleanup 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 Context Cleanup?

Context Cleanup is a specialized tool within the Openclaw Skills ecosystem designed to maintain the health and performance of AI agent workspaces. As agents operate, memory logs can become bloated, leading to high token consumption and redundant context that confuses the model. This skill provides a structured way to analyze, plan, and archive outdated or low-value records.

By implementing a safe-by-default archiving strategy, Context Cleanup ensures that historical data is preserved while keeping the active workspace lean. It is an essential utility for developers who need to manage long-running agentic workflows without sacrificing speed or accuracy.

Context Cleanup Use Cases

  • Archiving outdated session logs to minimize LLM token usage and costs.
  • Cleaning up workspace history before transitioning an agent to a new project phase.
  • Analyzing memory distribution to identify and remove low-value context files.
  • Automating routine workspace maintenance via scheduled CLI tasks.

How Context Cleanup Works

  1. Run the analysis command to scan the workspace and identify the current memory footprint.
  2. Generate a cleanup plan that categorizes records into low-value candidates and archival-ready items.
  3. Execute the archive command, which moves identified files to a safe location based on user confirmation or specific date cutoffs.

Context Cleanup Setup

To get started with this skill, ensure your environment has bash support and run the following commands from your workspace root:

# Initial analysis of the workspace
./skills/context-cleanup/cleanup.sh analyze

# Review the cleanup plan
./skills/context-cleanup/cleanup.sh plan

Context Cleanup Data Schema & Taxonomy

The skill operates based on specific file structures and exclusion rules to ensure system stability:

Component Description
cleanup.sh Main execution script for managing context lifecycle.
references/policy.md Defines the logic and thresholds for what constitutes archivable data.
Protected Files MEMORY.md, specs/, and AGENTS.md are strictly excluded from cleanup.
Archive Target Records are moved to an archive directory rather than being permanently deleted.

Context Cleanup Advanced Features

  • Date-based archiving: Specify a cutoff date to automatically archive all records older than a certain point.
  • Dry-run capability: Use the --dry-run flag to preview archival actions without moving any files.
  • Machine-readable output: Support for --json flags on analysis and planning for integration with custom dashboards.
  • Non-interactive mode: A --yes flag for automated CI/CD pipelines or power-user scripts.
  • Policy-driven management: Customizable archival logic through the local policy configuration.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins bash
Github Stars: 0
forks: 0

Featured*