session-rotate-80

Auto-create a new session when OpenClaw context usage reaches 80% without requiring Mem0 or file memory systems. Use when users want default OpenClaw to proactively rotate sessions and avoid context overflow in long chats.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "session-rotate-80" with this command: npx skills add 0range-x/session-rotate-80

Session Rotate 80

Overview

Trigger a standard [NEW_SESSION] message when context usage reaches 80%. This skill is memory-system-agnostic and works in plain default OpenClaw setups.

Workflow

  1. Read current context usage from runtime status.
  2. Run scripts/context_guard.py <used_tokens> <max_tokens>.
  3. If threshold reached, output the new-session trigger and handoff hint.
  4. Keep old session only for short handoff, then continue in new session.

Command

python scripts/context_guard.py <used_tokens> <max_tokens> --threshold 0.8 --channel boss

Example:

python scripts/context_guard.py 220000 272000 --threshold 0.8 --channel boss

Expected Output

At or above threshold:

  • [ROTATE_NEEDED]
  • [NEW_SESSION] 上下文达到80%(used/max),自动切换新会话
  • [HANDOFF_HINT] ...

Below threshold:

  • [ROTATE_NOT_NEEDED] ratio=x.xx < 0.800

Integration Hint (Heartbeat)

In heartbeat flow, after reading context usage:

  1. Call context_guard.py.
  2. If [ROTATE_NEEDED], emit [NEW_SESSION]... directly.
  3. Stop handling new tasks in old session except handoff confirmation.

scripts/

  • scripts/context_guard.py: threshold detector and trigger emitter (no memory dependency).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Ai Competitor Analyzer

提供AI驱动的竞争对手分析,支持批量自动处理,提升企业和专业团队分析效率与专业度。

Registry SourceRecently Updated
General

Ai Data Visualization

提供自动化AI分析与多格式批量处理,显著提升数据可视化效率,节省成本,适用企业和个人用户。

Registry SourceRecently Updated
General

Ai Cost Optimizer

提供基于预算和任务需求的AI模型成本优化方案,计算节省并指导OpenClaw配置与模型切换策略。

Registry SourceRecently Updated