Context Clean Up for Openclaw

A diagnostic utility that identifies prompt context bloat and generates a safe, reversible plan to reduce token costs and improve response speed.

phenomenoner
v1.0.7
Mar 9, 2026
7
3.6k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install context-clean-up

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 context-clean-up 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 Clean Up?

Context Clean Up is a specialized diagnostic utility designed to maintain the performance and cost-efficiency of AI agent sessions. Over time, prompt contexts can become bloated with oversized tool outputs, automation noise, or massive bootstrap documents, leading to slower response times and increased API expenses. This tool provides a safe, audit-only mechanism to identify these offenders within the ecosystem of Openclaw Skills, ensuring your agents remain lean and focused.

Instead of making destructive changes, this skill generates a comprehensive report that ranks risk factors and proposes a reversible optimization plan. It follows a strict safety model that avoids unattended configuration edits or silent pruning, giving developers full control over their agent environment while maintaining high-signal interactions.

Context Clean Up Use Cases

  • Prompt context is bloating, causing slow agent replies or rising API token costs.
  • Automation transcripts are filled with repetitive noise or unnecessary heartbeat messages.
  • Memory files like AGENTS.md or MEMORY.md have grown too large for efficient processing.
  • You need a ranked list of context offenders before applying manual optimizations to your Openclaw Skills setup.

How Context Clean Up Works

  1. Determine the scope by identifying the workspace and state directory (e.g., ~/.openclaw).
  2. Execute the bundled Python audit script to analyze session history and system state.
  3. Analyze the generated report to identify high-signal offenders like tool result dumps or bootstrap reinjection bloat.
  4. Review the multi-phase fix plan which ranks actions from low-risk noise discipline to higher-risk configuration narrowing.
  5. Implement manual changes based on the proposed plan and verify the results in a fresh session to confirm reduced context growth.

Context Clean Up Setup

To begin auditing your Openclaw Skills environment, ensure python3 is installed and run the following command to generate an audit report:

python3 scripts/context_cleanup_audit.py --workspace . --state-dir ~/.openclaw --out context-cleanup-audit.json

For Windows environments:

py -3 scripts/context_cleanup_audit.py --out context-cleanup-audit.json

Context Clean Up Data Schema & Taxonomy

The audit focuses on authoritative high-signal fields to measure bloat precisely. Data is organized by offender class and impact.

Field Description
eligible skills Count of active skills in the prompt surface
skills.promptChars Character count contributed by skill definitions
projectContextChars Size of the project-specific context files
promptTokens Total token usage for the current prompt session

Offenders are categorized into classes: Tool Result Dumps, Automation Transcript Noise, Bootstrap Reinjection Bloat, Ambient Specialist Surface, and Summary Accretion.

Context Clean Up Advanced Features

  • Audit-only execution ensures no automatic deletions or unattended config edits occur without review.
  • Reversible fix plans include exact change proposals, expected impact, and detailed rollback notes.
  • Multi-phase trim ladder allows for incremental optimization starting with lowest-risk noise discipline.
  • Authority-based measurement prioritizes fresh-session JSON receipts over subjective claims of context reduction in Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

Featured*