OpenClaw Session Guard
v1.0.0管理 OpenClaw 长会话防爆机制(80%自动归档、自动轮换新会话、低 token 交接)及定时任务安装。用户提到 compacting context、会话过长、自动总结归档、session 轮换、LaunchAgent 定时任务时使用。
MIT-0
Security Scan
OpenClaw
Suspicious
medium confidencePurpose & Capability
Name/description (session rotation, auto-archive, LaunchAgent scheduling) match the included scripts: they scan local OpenClaw sessions, write archives, update session mapping, create new session IDs, and invoke the openclaw CLI. However, the installer assumes macOS (LaunchAgents/launchctl) while the skill metadata has no OS restriction; also install.sh references a plist template file (ai.openclaw.session.rotator.plist.template) which is not present in the manifest—this packaging mismatch is unexpected.
Instruction Scope
Runtime behavior is broad: the rotator reads session files under ~/.openclaw/agents/, writes archives to ~/.openclaw/knowledge/, updates sessions.json to switch sessionId, writes cooldown/state files, and invokes the openclaw CLI to post the handoff message. These actions are coherent with its purpose but are sensitive: they modify user agent state and autonomously send messages via the openclaw CLI. Ensure you trust the openclaw binary and accept automated changes to session files.
Install Mechanism
There is no platform install spec (instruction-only) but an included install.sh installs a script to ~/bin and bootstraps a LaunchAgent via launchctl. Risks: the installer is macOS-specific (LaunchAgents) yet the skill has no OS restriction; the expected plist template file referenced by install.sh is missing from the provided manifest, which will cause install failure or unexpected behavior if not corrected. The install writes to user LaunchAgents and ~/bin (persistent system presence).
Credentials
The skill declares no required env vars, but scripts read optional envs (OPENCLAW_BIN, OPENCLAW_STATE_ROOT, etc.) and will call the openclaw CLI. That is appropriate for its function, but the scripts operate on many local files under ~/.openclaw and will update session state. There are no external network endpoints or hidden credential requests in the code itself, but the openclaw CLI it calls may perform network activity using your agent credentials—verify that CLI's trustworthiness.
Persistence & Privilege
The installer sets up a LaunchAgent to run periodically (default every 5 minutes via a plist template). This creates persistent background behavior that will autonomously scan and modify session state. While autonomy is expected for this feature, it increases blast radius; the package does not request explicit consent via metadata nor include an OS restriction, and the missing plist template further obfuscates exact schedule/configuration.
What to consider before installing
Before installing: 1) Inspect the missing plist template (ai.openclaw.session.rotator.plist.template) — confirm what the LaunchAgent will run and its schedule. 2) Backup ~/.openclaw/agents and sessions.json so you can recover if session IDs are changed. 3) Verify and trust the openclaw CLI binary on your PATH (install.sh calls it and that CLI will send messages/network requests). 4) Because the installer writes to ~/bin and ~/Library/LaunchAgents, prefer running install.sh manually after review rather than blindly executing it. 5) If you're not on macOS, do not install (the scripts use launchctl). If anything is unclear or the plist template is missing, ask the skill author for a complete package and an explanation of scheduling and safety safeguards.Like a lobster shell, security has layers — review code before you run it.
latest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
OpenClaw Session Guard
用于治理 OpenClaw 会话上下文过长导致的反复 compaction。
适用场景
- 用户反馈
compacting context频繁出现 - 想要“到阈值自动摘要+存档+续聊”
- 需要安装/检查/卸载会话轮换定时任务
默认策略
- 阈值:
80% - 冷却:
1800s(30 分钟) - 扫描周期:
300s(5 分钟) - 摘要条数:每个角色最近
6条
快速操作
- 安装/更新
bash ~/.openclaw/skills/openclaw-session-guard/scripts/install.sh
- 查看状态
bash ~/.openclaw/skills/openclaw-session-guard/scripts/status.sh
- 卸载
bash ~/.openclaw/skills/openclaw-session-guard/scripts/uninstall.sh
交付要求
- 给用户汇报:当前阈值、冷却、扫描周期
- 给用户汇报:最新归档文件与最新轮换 sessionId
- 若失败:给出可执行修复命令,不只描述原因
参考
- 详细机制和目录说明见 reference.md
Files
6 totalSelect a file
Select a file to preview.
Comments
Loading comments…
