← Back to Skills Marketplace
yuhui435

Context Monitor

by yuhui435 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
278
Downloads
0
Stars
2
Active Installs
1
Versions
Install in OpenClaw
/install context-monitor
Description
实时监控OpenClaw上下文窗口占用,超过阈值自动压缩旧对话并保留最近50轮及关键记忆,保持系统响应速度。
README (SKILL.md)

📊 Context Monitor Skill

版本: 1.0.0
创建时间: 2026-03-09
作者: AI Agent Team


🎯 技能说明

监控 OpenClaw 上下文窗口占用情况,当占用率超过阈值时自动压缩旧对话,保持系统响应速度。


📋 功能特性

  • ✅ 实时监控上下文窗口占用
  • ✅ 超过阈值自动压缩
  • ✅ 保留最近 50 轮对话
  • ✅ 保留关键记忆
  • ✅ 自动告警通知

🔧 配置参数

参数 默认值 说明
warning_threshold 70% 警告阈值
critical_threshold 90% 危险阈值
keep_recent_rounds 50 保留最近对话轮数
check_interval 3600 检查间隔(秒)

📁 文件结构

context-monitor/
├── SKILL.md              # 本文件
├── monitor.ps1           # 主监控脚本
├── compress.ps1          # 压缩脚本 脚本
├── config.json           # 配置文件
└── README.md             # 使用说明

🚀 使用方式

手动执行

powershell -ExecutionPolicy Bypass -File workspace/skills/context-monitor/monitor.ps1

Cron 自动执行

# 每小时检查一次
openclaw cron add --name context-monitor --cron "0 * * * *" --agent main --message "执行 context-monitor 技能"

📊 输出日志

日志位置: workspace/skills/context-monitor/log.txt

日志格式:

[2026-03-09 22:00:00] ✅ 上下文健康:占用率 45%
[2026-03-09 23:00:00] ⚠️ 上下文警告:占用率 75%
[2026-03-09 23:00:01] 🗜️ 已压缩旧对话,释放 30% 空间

⚠️ 注意事项

  1. 不要修改核心配置 - 本技能不修改 openclaw.json
  2. 定期清理日志 - 避免日志文件过大
  3. 检查压缩效果 - 确保重要对话未被压缩

📞 故障排查

问题 1:脚本无法执行

解决:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

问题 2:压缩失败

解决:

  • 检查文件权限
  • 检查磁盘空间
  • 查看日志文件

Last updated: 2026-03-09 22:41(东八区)

Usage Guidance
Do not install or enable this skill until you can review the actual scripts it references. Specifically: (1) request the monitor.ps1 and compress.ps1 source and inspect them for any network calls, deletion of files beyond conversation data, or credential access; (2) verify how '关键记忆' is identified and that retention logic is safe; (3) confirm the environment will have PowerShell and the OpenClaw CLI, or adjust the instructions; (4) avoid running Set-ExecutionPolicy Bypass persistently — prefer running PowerShell in a sandboxed session or using -ExecutionPolicy Bypass just for a single, reviewed script run; (5) if you cannot obtain or review the scripts, treat the skill as untrusted and do not schedule it as a cron job. Because the source is unknown and the published bundle is missing the implementation, proceed with caution.
Capability Analysis
Type: OpenClaw Skill Name: context-monitor Version: 1.0.0 The skill bundle (context-monitor) describes a utility for monitoring and modifying OpenClaw dialogue history, which involves high-risk capabilities like shell execution and memory manipulation. The SKILL.md file explicitly instructs the use of 'powershell -ExecutionPolicy Bypass', a security-weakening command used to run unsigned scripts. While these actions are plausibly aligned with the stated purpose of context management, the combination of shell access, the instruction to circumvent security policies, and the absence of the actual script logic (monitor.ps1 and compress.ps1) for verification warrants a suspicious classification.
Capability Assessment
Purpose & Capability
The stated purpose (monitor and compress context to keep responsiveness) is coherent with the described behavior. However, SKILL.md lists monitor.ps1, compress.ps1 and config.json as part of the skill, yet the package contains no code files. The instructions also assume the presence of the OpenClaw CLI (openclaw cron add) and PowerShell runtime without declaring them as requirements. That mismatch (declared file structure but no provided scripts, and unstated binary dependencies) is inconsistent.
Instruction Scope
The instructions tell the agent/operator to execute local PowerShell scripts that would modify/compact conversation data and write logs. Because the actual scripts are not present in the bundle, you cannot verify what data transformations, retention logic for “关键记忆”, or external communications the scripts would perform. The guidance to set ExecutionPolicy to Bypass elevates risk (it permits running arbitrary PowerShell code). The SKILL.md is also vague about how it identifies and preserves '关键记忆'.
Install Mechanism
This is an instruction-only skill with no install spec, which is low install-surface. However, the documentation implies files (scripts/config) should exist at workspace/skills/context-monitor/, yet they are not included. That discrepancy means the package as published is incomplete or expects out-of-band files — a red flag because missing files could be fetched or created later without review.
Credentials
The skill does not request environment variables, credentials, or config paths. That is proportionate for a local context-monitoring task. Nonetheless, because the runtime scripts are absent, we cannot confirm whether the actual implementation would access secrets or other configs.
Persistence & Privilege
always is false and the skill is not marked to modify agent/global configs (SKILL.md even warns not to change openclaw.json). No persistent install mechanism is declared. Still, the skill advises adding a cron job via the openclaw CLI (implying periodic autonomous runs), so ensure cron registration is what you expect before enabling.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install context-monitor
  3. After installation, invoke the skill by name or use /context-monitor
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of Context Monitor Skill. - Monitors OpenClaw context window usage in real time. - Automatically compresses older conversations when usage exceeds thresholds. - Retains the most recent 50 conversation rounds and key memories. - Sends warning and critical alerts as needed. - Configurable parameters for thresholds and check intervals. - Includes clear logging and troubleshooting guidance.
Metadata
Slug context-monitor
Version 1.0.0
License MIT-0
All-time Installs 3
Active Installs 2
Total Versions 1
Frequently Asked Questions

What is Context Monitor?

实时监控OpenClaw上下文窗口占用,超过阈值自动压缩旧对话并保留最近50轮及关键记忆,保持系统响应速度。 It is an AI Agent Skill for Claude Code / OpenClaw, with 278 downloads so far.

How do I install Context Monitor?

Run "/install context-monitor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Context Monitor free?

Yes, Context Monitor is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Context Monitor support?

Context Monitor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Context Monitor?

It is built and maintained by yuhui435 (@yuhui435); the current version is v1.0.0.

💬 Comments