ContextClaw for Openclaw

ContextClaw is a comprehensive session management and cleanup utility designed to optimize storage and analyze token consumption for AI agents.

rmruss2022
v1.0.0
Feb 17, 2026
0
1.3k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install contextclaw-usage

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 contextclaw-usage 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 ContextClaw?

ContextClaw is a specialized plugin for the OpenClaw ecosystem that provides developers with the tools needed to manage the data lifecycle of their AI agents. As one of the more technical Openclaw Skills, it focuses on session analysis, statistics, and storage optimization. It helps users understand their message history and token usage while providing automated ways to clean up temporary or old session data.

The tool acts as a maintenance layer, ensuring that your local environment remains performant by identifying large sessions and orphaned files. It distinguishes between critical main agent sessions and temporary sub-agent sessions, allowing for safe, rule-based pruning without the risk of losing important historical data.

ContextClaw Use Cases

  • Cleaning up storage space used by thousands of archived sub-agent sessions.
  • Monitoring token consumption trends to manage API costs and context window usage.
  • Identifying orphaned session files that are taking up space but are no longer indexed.
  • Visualizing session distribution and size through a graphical dashboard.
  • Automated maintenance of development environments through scheduled session pruning.

How ContextClaw Works

  1. The plugin scans the local sessions directory (typically located in ~/.openclaw/agents/main/sessions/) to index all session files.
  2. It parses the .jsonl files to calculate message counts, storage size, and estimated token usage based on character density.
  3. The tool categorizes each session by type, such as main, cron, or sub-agent, to determine retention priority.
  4. Users execute analysis commands to view formatted tables of session statistics or launch the web dashboard.
  5. Pruning and cleaning actions are performed through a multi-step process that defaults to a dry-run mode for maximum safety.

ContextClaw Setup

To get started with these Openclaw Skills, install the package via npm and register it as a plugin:

npm install -g @rmruss2022/contextclaw
openclaw plugins install @rmruss2022/contextclaw

Verify the installation and check the current status:

openclaw contextclaw status

ContextClaw Data Schema & Taxonomy

ContextClaw organizes and displays data using the following taxonomy:

Metric Definition
main Primary agent sessions, protected from automated deletion.
cron Sessions generated by scheduled tasks, also protected.
subagent Temporary sessions created for specific tasks, eligible for pruning.
Orphaned Session files present on disk but missing from the index.
Total Tokens Estimated count where 1 token is approximately 4 characters.
Storage The physical disk footprint of the .jsonl session logs.

ContextClaw Advanced Features

  • Integrated web dashboard providing bar charts and visual type breakdowns at http://localhost:18797.
  • Multi-tier safety logic that automatically excludes main and cron sessions from pruning operations.
  • Configurable age-based pruning allowing users to define custom retention windows (e.g., --days 60).
  • Orphaned file detection that finds and removes abandoned data resulting from crashes or manual file moves.
  • Interactive CLI prompts for live-run confirmations to prevent accidental data loss.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*