Install
openclaw skills install context-optimizer-proMonitors token usage in long sessions, extracts key info, and creates continuation sessions to manage context limits automatically.
openclaw skills install context-optimizer-proAutomatic context management skill that monitors token usage and creates continuation sessions when needed.
This skill provides:
# 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
Add to your workflow or cron:
Every 10 minutes: Run context-optimizer check
When context exceeds threshold, the skill will:
The optimizer extracts in this order:
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]
context_optimizer.py - Main CLI for context monitoring and splittingsession_extractor.py - Extracts key information from session historyTo automatically split sessions when context exceeds 95%, integrate with OpenClaw's heartbeat:
## Context Monitor
Every heartbeat: Check session_status
If context > 85%: Log warning
If context > 95%: Run context-optimizer split
sessionTarget: "isolated" to run context checks independently.The skill uses these OpenClaw tools:
session_status - Get current token/context usagesessions_history - Fetch conversation for extractionsessions_spawn - Create continuation sessioncron - Schedule periodic checks