multiAI Summary Pending

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.

3,556 stars

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/session-rotate-80/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/0range-x/session-rotate-80/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/session-rotate-80/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How session-rotate-80 Compares

Feature / Agentsession-rotate-80Standard Approach
Platform SupportmultiLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Which AI agents support this skill?

This skill is compatible with multi.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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
```bash
python scripts/context_guard.py <used_tokens> <max_tokens> --threshold 0.8 --channel boss
```

Example:
```bash
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).