Search

PythonReactSEOPDF
OpenClaw

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.

0range-x0 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install 0range-x/session-rotate-80

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

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 information

Source
github
Repository
openclaw/skills
Path
skills/0range-x/session-rotate-80
Version
—
Commit
f6b85ecf644192fc2f5df4e4e850d177f5742b86
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

README

Session Rotate 80

不依赖记忆系统的 OpenClaw 会话轮换技能。

当上下文占用率达到 80% 时,自动输出新会话触发指令,避免长对话把上下文顶满。

特性

  • ✅ 默认 OpenClaw 可用(无 Mem0、无文件记忆也能工作)
  • ✅ 上下文占用率阈值触发(默认 80%)
  • ✅ 标准化新会话触发消息([NEW_SESSION] ...)
  • ✅ 提供最小交接提示,减少会话切换后的信息断层

适用场景

  • 你只想要“到 80% 就切新会话”的硬规则
  • 你不准备搭建完整记忆系统
  • 你在 Discord 长时间连续对话,想避免上下文溢出降质

快速开始

安装
clawhub install session-rotate-80

或手动:

git clone https://github.com/0range-x/session-rotate-80.git
运行
python scripts/context_guard.py <used_tokens> <max_tokens> --threshold 0.8 --channel boss

示例:

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

输出说明

触发时
  • [ROTATE_NEEDED]
  • [NEW_SESSION] 上下文达到80%(used/max),自动切换新会话
  • [HANDOFF_HINT] 在旧会话保留3行交接:当前目标、已完成、下一步
未触发时
  • [ROTATE_NOT_NEEDED] ratio=x.xx < 0.800

接入建议(Heartbeat)

在你的心跳或状态检查流程里:

  1. 读取当前上下文占用(used/max)
  2. 调用 context_guard.py
  3. 命中后直接发送 [NEW_SESSION] ...
  4. 旧会话只做交接,不再承载新任务

与记忆系统关系

  • 本技能可以独立工作
  • 即使无记忆系统,也能稳定执行“80%自动切换”
  • 若后续接入记忆系统,可在触发前加“自动交接摘要写入”获得更好连续性

实用指南

推荐搭配规则:

  1. 阈值固定 80%
  2. 切换后第一条消息粘贴交接三行
  3. 单会话尽量只做一个主题
  4. 2到3天主动切一次会话,即使没到 80%

作者

小橘(vulcanx_14970)

Twitter: @maru_49940

许可证

MIT

Extracted content

SKILL.md
# 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).
README
# Session Rotate 80

不依赖记忆系统的 OpenClaw 会话轮换技能。

当上下文占用率达到 80% 时,自动输出新会话触发指令,避免长对话把上下文顶满。

## 特性

- ✅ 默认 OpenClaw 可用(无 Mem0、无文件记忆也能工作)
- ✅ 上下文占用率阈值触发(默认 80%)
- ✅ 标准化新会话触发消息(`[NEW_SESSION] ...`)
- ✅ 提供最小交接提示,减少会话切换后的信息断层

## 适用场景

- 你只想要“到 80% 就切新会话”的硬规则
- 你不准备搭建完整记忆系统
- 你在 Discord 长时间连续对话,想避免上下文溢出降质

## 快速开始

### 安装

```bash
clawhub install session-rotate-80
```

或手动:

```bash
git clone https://github.com/0range-x/session-rotate-80.git
```

### 运行

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

示例:

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

## 输出说明

### 触发时

- `[ROTATE_NEEDED]`
- `[NEW_SESSION] 上下文达到80%(used/max),自动切换新会话`
- `[HANDOFF_HINT] 在旧会话保留3行交接:当前目标、已完成、下一步`

### 未触发时

- `[ROTATE_NOT_NEEDED] ratio=x.xx < 0.800`

## 接入建议(Heartbeat)

在你的心跳或状态检查流程里:

1. 读取当前上下文占用(used/max)
2. 调用 `context_guard.py`
3. 命中后直接发送 `[NEW_SESSION] ...`
4. 旧会话只做交接,不再承载新任务

## 与记忆系统关系

- 本技能可以独立工作
- 即使无记忆系统,也能稳定执行“80%自动切换”
- 若后续接入记忆系统,可在触发前加“自动交接摘要写入”获得更好连续性

## 实用指南

推荐搭配规则:

1. 阈值固定 80%
2. 切换后第一条消息粘贴交接三行
3. 单会话尽量只做一个主题
4. 2到3天主动切一次会话,即使没到 80%

## 作者

小橘(vulcanx_14970)

Twitter: [@maru_49940](https://x.com/maru_49940)

## 许可证

MIT

Related skills

OpenClaw

bambu-studio-ai

heyixuan2

Bambu Lab 3D printer control and automation. Activate when user mentions: printer status, 3D printing, slice, analyze model, generate 3D, AMS filament, print monitor, Bambu Lab, or any 3D printing task. Full pi...

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

0protocol

0isone

Agents can sign plugins, rotate credentials without losing identity, and publicly attest to behavior.

OpenClaw

0x0-messenger

eijiac24

Send and receive P2P messages using disposable numbers and PINs. No servers, no accounts. Use for human notifications, approval flows, and agent-to-agent communication.