Context Manager V2
Auto context management with seamless session switching. Monitors usage, triggers at 70% threshold (proactive check every 10 tool calls), automatically creat...
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 0 · 13 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
OpenClaw
Suspicious
medium confidencePurpose & Capability
The skill's goal (context monitoring and automatic session switching) aligns with the scripts, which call the OpenClaw CLI to get session info and send notifications. However the package metadata declares no required binaries or credentials, yet the scripts rely on external tools (openclaw CLI, jq, timeout, crontab) and on the user's OpenClaw messaging/account configuration. Also the SKILL.md and README claim an 'agentTurn' that creates a new session; the actual trigger_new_session() function only logs actions and does not call any API to create a session—this is a functional mismatch between claims and implementation.
Instruction Scope
Runtime instructions and scripts instruct installation of a cron task, periodic calls to scripts, writing/appending MEMORY.md and per-day logs, and sending notifications via 'openclaw message send'. The actions are within the context-management purpose, but they perform file writes under the user's OpenClaw workspace and can send messages out via configured messaging channels. The SKILL.md instructs installing via clawhub / cron; that will give the skill persistent background activity. No instructions attempt to read arbitrary unrelated system files, but scripts may access workspace and /tmp and expect a utils error handler.
Install Mechanism
There is no formal install spec in the registry metadata, but the repo includes an install.sh that copies files into ~/.openclaw/skills and modifies the user's crontab. The install script is local (no remote downloads), which reduces remote-code risk, but it will change crontab and create persistent cron tasks. You should review install.sh before running and be aware it registers periodic background jobs.
Credentials
The skill declares no required environment variables or primary credential, but scripts implicitly rely on the user's OpenClaw CLI configuration (which contains credentials) and on messaging targets like FEISHU_TARGET and QQ_TARGET (defaults are placeholders). The code also sanitizes logs for patterns like 'sk-...' and tokens, implying it expects to handle secrets in logs. Because scripts send messages through the user's configured channels, the skill can cause outbound notifications without declaring or prompting for credentials—this is disproportionate to the lack of declared requirements and warrants caution.
Persistence & Privilege
The skill does not set always:true and does not request elevated system-wide privileges, but the included install.sh will add a cron job to the user's crontab and create persistent files under ~/.openclaw/skills and the workspace logs/memory directories. That gives the skill a continuous background presence until the cron entry and files are removed.
What to consider before installing
What to check before installing:
- Inspect and understand the scripts (especially scripts/seamless-switch.sh, context-monitor-*.sh, and install.sh). The installer will add a cron job and create persistent files under your home directory.
- Required tools are not declared in the registry metadata: the scripts call 'openclaw', 'jq', 'timeout' and rely on crontab. Make sure you are comfortable with those tools running under your account and that 'openclaw' is configured with the correct account (it will use your agent credentials).
- The README/SKILL.md claim automatic session creation via 'agentTurn', but the shipped scripts only log the trigger_new_session action rather than invoking an API to create a session. Expect actual behavior to be more limited than the marketing text suggests.
- The skill can send outbound notifications using your OpenClaw message channel targets (Feishu/QQ). Verify FEISHU_TARGET/QQ_TARGET in config.json (or set environment overrides) before enabling to avoid unexpected messages.
- Because the scripts write MEMORY.md / daily logs and generate error logs, review those files for any sensitive content and decide whether you want automated writing/appending in your workspace. The error report script attempts to redact some token patterns, but redaction is not a guarantee.
Recommended steps if you proceed:
1) Do not run install.sh without review—open and read it to confirm crontab changes. 2) Run the monitor scripts manually (bash scripts/context-monitor.sh) to observe behavior before adding cron. 3) Ensure jq and openclaw are present and configured, and test 'openclaw sessions --json' yourself. 4) Set correct notification targets in config.json or disable notifications. 5) If you want full automation, confirm or implement the actual session-creation API call where trigger_new_session() is defined.
Given the undocumented external-tool requirements and the mismatch between claimed and implemented behavior, treat this skill with caution. If you want a definitive judgment, provide the intended install flow (did you run install.sh?) and whether your environment already has the openclaw CLI configured—that would raise confidence in the assessment.Like a lobster shell, security has layers — review code before you run it.
Current versionv2.4.2
Download ziplatest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
Context Manager v2.2 - 无感会话切换
自动监控上下文使用率,达到阈值时自动保存记忆并创建新会话,用户完全无感知。
🎯 核心特性
- 启动优化:分层读取(核心<5KB + 摘要<10KB + QMD检索),启动占用<10%
- 无感自动切换:70%阈值自动触发agentTurn创建新会话
- 主动保存:每10次工具调用后自动检查上下文,不等阈值
- 真实API监控:totalTokens/contextTokens准确计算,每5分钟检查
- 记忆传递:自动更新MEMORY.md + MEMORY-LITE.md + daily log
- 冷却机制:1小时冷却期,避免重复通知
📋 工作流程
启动 → 读SOUL/USER → 读MEMORY-LITE → session_status检测(>30%预警)
对话中 → 每10次工具调用主动检查 + 每5分钟定时监控 → ≥70%自动保存记忆 → agentTurn新会话 → 分层加载 → 自然继续
🚀 使用方式
# 安装
clawhub install miliger-context-manager
# 配置定时任务
*/5 * * * * ~/.openclaw/skills/context-manager/scripts/seamless-switch.sh
# 查看日志
tail -50 ~/.openclaw/workspace/logs/seamless-switch.log
🔧 阈值配置
DIALOG_THRESHOLD=70 # 对话中触发切换(原85%,降低到70%提前保护)
STARTUP_THRESHOLD=30 # 启动后警告
📊 版本里程碑
- v2.0:无感自动切换(agentTurn)
- v2.1:启动优化(分层读取,节省75%空间)
- v2.2:真实API监控(70%阈值,5分钟间隔)
- v2.2.2:阈值85→70%,增加每10次工具调用主动检查
- v2.2.1:Cron环境修复(生产就绪)
⚠️ 注意
- 新会话不说"新会话"/"已切换",自然接续
- MEMORY-LITE.md需手动创建(<10KB精简版)
- 与smart-memory-sync双保险协作
🔄 主动保存机制(Proactive Save)
在对话过程中,除了定时监控外,还应在每10次工具调用后主动检查上下文:
# 在对话流中,每处理10次工具调用后执行:
TOOL_CALL_COUNT=$((TOOL_CALL_COUNT + 1))
if [ $((TOOL_CALL_COUNT % 10)) -eq 0 ]; then
session_status # 检查当前上下文占用
# 如果占用>50%,即使未达阈值也主动保存关键记忆
# 确保compaction前已有备份
fi
目的:不等阈值触发,提前保护对话上下文,防止compaction丢失信息。
详细技术实现、性能指标、版本历史见
references/skill-details.md
📄 许可证与版权声明
MIT License
Copyright (c) 2026 思捷娅科技 (SJYKJ)
免费使用、修改和重新分发时,需注明出处。
出处:
- GitHub: https://github.com/zhaog100/openclaw-skills
- ClawHub: https://clawhub.com
- 创建者:小米辣 (PM + Dev)
商业使用授权:
- 个人/开源:免费
- 小微企业(<10 人):¥999/年
- 中型企业(10-50 人):¥4,999/年
- 大型企业(>50 人):¥19,999/年
- 源码买断:¥99,999 一次性
详情请查看:LICENSE
Files
11 totalSelect a file
Select a file to preview.
Comments
Loading comments…
