← 返回 Skills 市场
ericgogogogogo

Context Optimizer Pro

作者 Ericgogogogogo · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
153
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install context-optimizer-pro
功能描述
Monitors token usage in long sessions, extracts key info, and creates continuation sessions to manage context limits automatically.
使用说明 (SKILL.md)

Context Optimizer

Automatic context management skill that monitors token usage and creates continuation sessions when needed.

Core Functionality

This skill provides:

  1. Context Monitoring - Track token usage against 200k max
  2. Threshold Detection - Trigger at 95% (190k tokens)
  3. Information Extraction - Extract key decisions, important context, unfinished tasks
  4. Session Continuation - Create new session with summarized context

Usage

Manual Trigger

# Check current context usage
context-optimizer check

# Force extraction and create continuation
context-optimizer split --threshold 95

# Preview what would be extracted
context-optimizer preview

Automatic Monitoring

Add to your workflow or cron:

Every 10 minutes: Run context-optimizer check

When context exceeds threshold, the skill will:

  1. Analyze conversation history
  2. Extract key information (decisions, context, todos)
  3. Generate continuation prompt
  4. Create new session with extracted context

Extraction Priority

The optimizer extracts in this order:

  1. Unfinished tasks - Incomplete actions, pending decisions
  2. Key decisions - Important choices and their rationale
  3. Critical context - Information essential to task completion
  4. User preferences - Explicitly stated preferences and requirements
  5. Recent progress - What has been accomplished so far

Output Format

When creating continuation, output:

# Session Continuation

## Completed
- [list of finished items]

## In Progress
- [current work items]

## Key Context
- [essential information to preserve]

## Next Steps
- [suggested next actions]

---

## Continuation Prompt
[Prompt to use in new session]

Scripts

  • context_optimizer.py - Main CLI for context monitoring and splitting
  • session_extractor.py - Extracts key information from session history

Integration with OpenClaw

Automatic Split Logic

To automatically split sessions when context exceeds 95%, integrate with OpenClaw's heartbeat:

  1. Add to HEARTBEAT.md:
## Context Monitor
Every heartbeat: Check session_status
If context > 85%: Log warning
If context > 95%: Run context-optimizer split
  1. Create Cron Job: Use cron with sessionTarget: "isolated" to run context checks independently.

Tool Integration

The skill uses these OpenClaw tools:

  • session_status - Get current token/context usage
  • sessions_history - Fetch conversation for extraction
  • sessions_spawn - Create continuation session
  • cron - Schedule periodic checks
安全使用建议
This skill appears to do what it says: monitor context usage, parse conversation history, and produce continuation prompts. Before installing: (1) Review and test the scripts in a safe environment to confirm they only access session history and OpenClaw tools you expect; (2) be aware continuation prompts may include file paths, config snippets, error messages, or other sensitive strings found in conversation history — consider sanitizing history or restricting which conversations it reads; (3) if you enable cron/heartbeat integration, run it in an isolated sessionTarget or with limited permissions to avoid unintentional exposure; (4) if you have strict data-handling policies, inspect/modify the extractor regexes to exclude secrets (API keys, tokens) or add explicit redaction prior to generating continuation prompts.
功能分析
Type: OpenClaw Skill Name: context-optimizer-pro Version: 1.0.0 The 'context-optimizer-pro' skill is a legitimate utility designed to manage LLM context limits by monitoring token usage and automatically summarizing session history to spawn continuation sessions. It utilizes standard OpenClaw tools like 'session_status', 'sessions_history', and 'sessions_spawn' as described in 'SKILL.md' and 'scripts/context_optimizer.py'. The logic is transparent, focusing on extracting tasks, decisions, and file paths via regex to maintain continuity, with no evidence of data exfiltration, malicious execution, or unauthorized persistence.
能力评估
Purpose & Capability
Name/description align with what the code and SKILL.md do: monitor token usage, parse session history, extract key items, and create continuation prompts via OpenClaw tools (session_status, sessions_history, sessions_spawn). No unrelated env vars, binaries, or config paths are requested.
Instruction Scope
Instructions and scripts explicitly read session history and session status (expected). They also recommend cron / heartbeat integration for periodic checks (also expected). Be aware the extractor intentionally searches for file paths, config lines, errors, and user preferences and will include them in generated continuation prompts — this is within scope but can surface sensitive information if present in history.
Install Mechanism
No install spec (instruction-only with included scripts). Nothing is downloaded or written by an installer; risk from install mechanism is low. The skill includes Python scripts but does not attempt to install external packages or fetch code at runtime.
Credentials
The skill requests no environment variables or credentials. The code references a HOME-based memory path (~/.openclaw/...) but does not require access to external secrets. Extraction patterns intentionally look for configuration/URLs/file paths in session content — that behavior matches the stated purpose but could reveal sensitive items present in session history.
Persistence & Privilege
always is false and the skill does not request system-wide persistence or modify other skills. It recommends periodic invocation via cron/heartbeat which is reasonable for its function; autonomous invocation is allowed by default but not exceptional here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-optimizer-pro
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-optimizer-pro 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release - context monitoring and auto-split at 95% threshold
元数据
Slug context-optimizer-pro
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Context Optimizer Pro 是什么?

Monitors token usage in long sessions, extracts key info, and creates continuation sessions to manage context limits automatically. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 153 次。

如何安装 Context Optimizer Pro?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install context-optimizer-pro」即可一键安装,无需额外配置。

Context Optimizer Pro 是免费的吗?

是的,Context Optimizer Pro 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Context Optimizer Pro 支持哪些平台?

Context Optimizer Pro 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context Optimizer Pro?

由 Ericgogogogogo(@ericgogogogogo)开发并维护,当前版本 v1.0.0。

💬 留言讨论