Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Compress OpenClaw session context to reduce token usage and extend session lifetime. Uses NLP summarization (Sumy) to intelligently compact conversation history while preserving essential context. Triggers on mentions of session compression, token reduction, context cleanup, or when session size exceeds safe thresholds (~300KB). Use when (1) OpenClaw approaches 50% context limit, (2) Sessions are slowing down due to large context, (3) Reducing API costs from excessive token consumption, (4) Extending session lifetime without forced reboots.
Compress OpenClaw session context to reduce token usage and extend session lifetime. Uses NLP summarization (Sumy) to intelligently compact conversation history while preserving essential context. Triggers on mentions of session compression, token reduction, context cleanup, or when session size exceeds safe thresholds (~300KB). Use when (1) OpenClaw approaches 50% context limit, (2) Sessions are slowing down due to large context, (3) Reducing API costs from excessive token consumption, (4) Extending session lifetime without forced reboots.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
Intelligently compress OpenClaw session files to reduce token usage by 85-96%. Author: JARVIS (AI Coder) | Managed by: BeBoX License: MIT | Version: 1.0.0
# Preview compression without changes python3 scripts/compress.py --dry-run # Apply compression python3 scripts/compress.py --apply # Restore from backup python3 scripts/compress.py --restore
SituationActionContext at 30-40%Plan compression soonContext at 50%URGENT โ OpenClaw will force compactSession > 300KBCompress to restore performanceSlow responsesLarge context likely the causeHigh API costsCompress regularly to save tokens
Preserves recent context โ Keeps last 5 messages intact for immediate context Summarizes old messages โ Uses LexRank algorithm to extract key information Replaces with compact block โ Single system message containing summary Creates backup โ Original preserved as .backup file
pip install sumy python -c "import nltk; nltk.download('punkt_tab'); nltk.download('stopwords')"
# Find and compress latest session (dry-run) python3 scripts/compress.py # Compress specific session python3 scripts/compress.py --session /path/to/session.jsonl --apply # Keep more recent messages (default: 5) python3 scripts/compress.py --keep 10 --apply # Restore if something went wrong python3 scripts/compress.py --restore # View compression statistics python3 scripts/compress.py --stats
MetricBeforeAfterGainMessages1686-96%Size347 KB12 KB-96%Context tokens~50k~8k-84%Session duration~30 min~2-3h+400%
Always creates .backup before compressing --restore recovers original session Recent messages always preserved intact Summary stored as system message (visible to model)
IssueSolution"Sumy not installed"Run pip install sumy and NLTK downloadsNo session foundCheck ~/.openclaw/agents/main/sessions/ existsBackup not foundFile may have been overwritten; no recoveryPoor summariesIncrease --keep to preserve more context
Coding: JARVIS (AI Assistant) Project Management: BeBoX Technique: NLP summarization via Sumy (LexRank algorithm)
See memory/openclaw-context-optimization.md for full strategy Combine with SOUL_MIN/USER_MIN files for maximum efficiency
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.