← 返回 Skills 市场
rmruss2022

ContextClaw Plugin Usage

作者 rmruss2022 · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
663
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install contextclaw-usage
功能描述
Manage and analyze OpenClaw sessions by checking usage, pruning old sessions, cleaning orphaned files, and viewing stats via CLI or dashboard.
使用说明 (SKILL.md)

ContextClaw Plugin Usage

When to Use

Use this skill when the user asks about:

  • Session management or cleanup
  • Context usage or token consumption
  • Storage space used by sessions
  • Pruning old sessions
  • Cleaning up orphaned session files
  • Session analysis or statistics
  • Which sessions are taking up space
  • How many messages/tokens in sessions

Prerequisites

The ContextClaw plugin must be installed:

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

Quick Start

Check if ContextClaw is installed and running:

openclaw contextclaw status

Commands

Analyze Sessions

Get comprehensive analysis of all sessions:

openclaw contextclaw analyze

This shows:

  • Total sessions, messages, tokens, storage size
  • Largest sessions (top 10)
  • Oldest sessions (top 10)
  • Orphaned sessions

Prune Old Sessions

Clean up sessions older than N days (default: 30):

# Dry run (preview only, safe)
openclaw contextclaw prune --days 30

# Live run (actually deletes)
openclaw contextclaw prune --days 30 --dryRun false

Safety features:

  • Dry run by default (previews before deleting)
  • Always keeps main agent sessions
  • Always keeps cron sessions
  • Shows confirmation before deleting

Clean Orphaned Sessions

Remove session files not referenced in sessions.json:

# Dry run
openclaw contextclaw clean-orphaned

# Live run
openclaw contextclaw clean-orphaned --dryRun false

Dashboard

Open the visual session management dashboard:

openclaw contextclaw dashboard

This opens http://localhost:18797

Quick Stats

Show brief status and statistics:

openclaw contextclaw status

Configuration

Reconfigure port or OpenClaw home:

openclaw contextclaw setup

Dashboard Features

The dashboard at http://localhost:18797 provides:

  • Session statistics - Total sessions, messages, tokens, storage
  • Multiple views - All, Largest, Oldest, Orphaned, Charts
  • Bar charts - Visual size distribution
  • Type breakdown - Sessions by agent type (main, cron, sub-agent)
  • Quick actions - Prune and clean from UI (preview only)

Example Usage

User asks: "How much storage are my sessions using?"

Response:

openclaw contextclaw analyze

Look at the "Total Size" metric in the summary table.

User asks: "Clean up old sessions"

Response:

# First preview what would be deleted
openclaw contextclaw prune --days 30

# If approved, run live:
openclaw contextclaw prune --days 30 --dryRun false

User asks: "Which sessions are taking up the most space?"

Response:

openclaw contextclaw analyze

Check the "Largest Sessions" table, or open the dashboard:

openclaw contextclaw dashboard

User asks: "Remove orphaned session files"

Response:

# Preview first
openclaw contextclaw clean-orphaned

# If user approves, run live:
openclaw contextclaw clean-orphaned --dryRun false

Session Types

ContextClaw categorizes sessions as:

  • main - Main agent session (protected from pruning)
  • cron - Cron job sessions (protected from pruning)
  • subagent - Spawned sub-agent sessions (can be pruned)
  • unknown - Unrecognized session types

Orphaned Sessions

A session is orphaned if:

  • .jsonl file exists in sessions directory
  • Session ID is NOT in sessions.json

Common causes:

  • Completed sub-agent removed from index
  • Manual file operations
  • Crashed sessions
  • Development/testing

Orphaned sessions are safe to delete.

Best Practices

  1. Analyze regularly - Weekly or monthly: openclaw contextclaw analyze
  2. Always dry-run first - Preview before deleting
  3. Adjust age threshold - 30 days is default, adjust as needed
  4. Review orphaned - Check before cleaning
  5. Backup if worried - Though main/cron are protected

Troubleshooting

If dashboard won't load:

openclaw contextclaw status  # Check if running
openclaw contextclaw start   # Start if stopped

If port is in use:

openclaw contextclaw setup
# Choose a different port

Technical Details

  • Port: 18797 (default, configurable)
  • Analysis: Parses all .jsonl files in ~/.openclaw/agents/main/sessions/
  • Token estimation: 1 token ≈ 4 characters (approximate)
  • Storage: Read-only, no database

Example Output

Analyze Command

📊 Session Analysis

┌──────────────────┬────────┐
│ Metric           │ Value  │
├──────────────────┼────────┤
│ Total Sessions   │ 45     │
│ Total Messages   │ 3,842  │
│ Total Tokens     │ 156,234│
│ Total Size       │ 12.4 MB│
│ Orphaned         │ 8      │
└──────────────────┴────────┘

Prune Command

🧹 Session Pruning

⚠️  DRY RUN MODE - No files will be deleted

Sessions older than 30 days:
  ✓ Would delete: 12
  - Would keep: 33
  - Space freed: 4.2 MB

? Run prune in LIVE mode (actually delete files)? (y/N)

Repository

GitHub: https://github.com/rmruss2022/ContextClaw npm: @rmruss2022/contextclaw

安全使用建议
This skill appears to do what it claims — manage and prune local OpenClaw session files. Before installing: (1) verify the referenced GitHub repo and npm package (@rmruss2022/contextclaw) look legitimate and review their source if possible, since npm global installs run third-party code; (2) always run analyze and the prune/clean-orphaned commands in dry-run mode first and back up your session directory if you are worried; (3) confirm the dashboard binds only to localhost and choose a different port if you have concerns about local network exposure.
功能分析
Type: OpenClaw Skill Name: contextclaw-usage Version: 1.0.0 The skill instructs the agent to install an external npm package globally (`@rmruss2022/contextclaw`), which introduces a supply chain risk. Additionally, the skill provides commands with the capability to delete user session files, a high-risk operation, even though the `SKILL.md` instructions emphasize safety features like dry runs and user confirmation. There is no evidence of malicious intent such as data exfiltration, backdoor installation, or harmful prompt injection against the agent, but the inherent risky capabilities warrant a 'suspicious' classification.
能力评估
Purpose & Capability
The name/description (session management, pruning, stats) matches the runtime instructions: analyze/prune/clean-orphaned/dashboard commands operating on OpenClaw sessions. Declared prerequisites (install the ContextClaw plugin) and referenced artifacts (sessions .jsonl files under ~/.openclaw/agents/main/sessions/) are coherent with the stated purpose.
Instruction Scope
SKILL.md only describes running the ContextClaw/OpenClaw CLI and opening a local dashboard, and explicitly documents which files it reads (~/.openclaw/.../sessions/). It also documents deletion operations (prune/clean-orphaned) and safety practices (dry-run, keep main/cron sessions). The instructions do not attempt to read unrelated system locations or exfiltrate data to remote endpoints.
Install Mechanism
The skill is instruction-only (no install spec), but requires the user to install an npm package globally (@rmruss2022/contextclaw) and register the plugin with openclaw. That is a reasonable requirement for this functionality, but installing arbitrary npm packages and running plugin installers executes third-party code on the host—users should verify the package and repo before installing. The lack of an automated install spec is not a security problem but is worth noting.
Credentials
No environment variables, credentials, or unrelated config paths are requested. The only filesystem access described is to the sessions directory under the user's OpenClaw home, which is appropriate for session management.
Persistence & Privilege
The skill does not request always:true or other elevated/intrusive privileges. It runs as an invoked plugin/CLI and advises dry-run/default protection for key session types (main/cron). Nothing in the instructions indicates it modifies other skills' configurations or requires permanent system-wide changes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install contextclaw-usage
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /contextclaw-usage 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Skill for using ContextClaw plugin
元数据
Slug contextclaw-usage
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

ContextClaw Plugin Usage 是什么?

Manage and analyze OpenClaw sessions by checking usage, pruning old sessions, cleaning orphaned files, and viewing stats via CLI or dashboard. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 663 次。

如何安装 ContextClaw Plugin Usage?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install contextclaw-usage」即可一键安装,无需额外配置。

ContextClaw Plugin Usage 是免费的吗?

是的,ContextClaw Plugin Usage 完全免费(开源免费),可自由下载、安装和使用。

ContextClaw Plugin Usage 支持哪些平台?

ContextClaw Plugin Usage 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 ContextClaw Plugin Usage?

由 rmruss2022(@rmruss2022)开发并维护,当前版本 v1.0.0。

💬 留言讨论