with one click
context-manager
AI-powered context management for OpenClaw sessions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
AI-powered context management for OpenClaw sessions
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
霸下销售总监大师技能包 — 全球顶尖B2B销售能力。对标华为铁三角+Salesforce+麦肯锡谈判法。
墨白首席美学官大师技能包 — 全球顶级视觉战略能力。对标伦敦皇家艺术学院 + 奥美全球 + 苹果Jony Ive设计标准。
轩辕AI编码舰队——OpenClaw作为大脑,指挥Claude Code/Cursor/Windsurf/Trae/Codex CLI集群并行开发。覆盖:ACP配置、IDE接入、权限管理、任务分发、windsurf+cursor双IDE调度、worktree隔离、舰队看板。触发词:IDE舰队、编码集群、AI IDE、多工具编排、ACP配置、Cursor舰队、Windsurf集群、Trae接入、IDE调度、并行编码、AI编码引擎、IDE编排、coding fleet
项目进度追踪与SDLC全周期管理——ETA承诺、实时看板、风险预警、多项目并行调度。覆盖:任务拆解协议、ETA估算模型、进度追踪机制、日报/周报模板、风险预警系统、承诺驱动开发。触发词:项目进度、SDLC、ETA、甘特图、看板、燃尽图、里程碑、进度追踪、project management、进度汇报、阻塞告警
2025年最前沿的AI原生开发范式——VibeCoding。覆盖:Prompt-to-Product工作流、多轮对话管理、AI编码助手协作策略、代码质量保障、v0.dev/Lovable/Claude Code/Replit Agent工具链集成。触发词:vibecoding、VibeCoding、AI原生开发、提示即产品、AI pair programming、conversation-driven coding、prompt engineering for products
飞书云文档内容优化与格式美化。当用户需要优化飞书文档的排版、结构、格式、美观度时使用此技能。支持:(1) 读取飞书文档内容 (2) 优化文档结构和层次 (3) 清空并替换文档内容 (4) 通过浏览器自动化编辑文档。触发词:优化飞书文档、美化文档、整理文档格式、文档排版。
| name | context-manager |
| description | AI-powered context management for OpenClaw sessions |
| user-invocable | true |
| author | Daniel Li |
AI-powered context management for OpenClaw sessions. Uses the agent itself to generate intelligent summaries, then resets the session with compressed context.
# List all sessions with usage stats
~/openclaw/skills/context-manager/compress.sh list
# Check status of a specific session
~/openclaw/skills/context-manager/compress.sh status agent:main:main
# Generate AI summary (read-only, safe)
~/openclaw/skills/context-manager/compress.sh summarize agent:main:main
# Compress session: generate summary, reset, inject (DESTRUCTIVE)
~/openclaw/skills/context-manager/compress.sh summarize agent:main:main --replace
memory/compressed/Key insight: The agent has full visibility into its own context, so it generates the best possible summary.
| Command | Description |
|---|---|
list | List all sessions with token usage |
status [KEY] | Show detailed status for a session |
summarize [KEY] | Generate AI summary (read-only) |
summarize [KEY] --replace | Summarize AND reset session with compressed context |
compress [KEY] | Legacy grep-based extraction (not recommended) |
check [KEY] | Check if session exceeds threshold |
check-all | Check all sessions at once |
| Command | Description |
|---|---|
set-threshold N | Set compression threshold (50-99%, default: 80) |
set-depth LEVEL | Set depth: brief/balanced/comprehensive |
set-quiet-hours HH | Set quiet hours (e.g., "23:00-07:00") |
help | Show help and usage examples |
$ ~/openclaw/skills/context-manager/compress.sh list
📋 Available Sessions (4 total)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# SESSION KEY KIND TOKENS USAGE
1 agent:main:main direct 70188 70%
2 agent:main:slack:channel:c0aaruq2en9 group 20854 20%
3 agent:main:cron:0d02af4b-... direct 18718 18%
$ ~/openclaw/skills/context-manager/compress.sh status agent:main:main
📊 Context Manager Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Key: agent:main:main
Session ID: fc192a2d-091c-48c7-9fad-12bf34687454
Kind: direct
Model: gemini-3-flash
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Threshold: 80%
Tokens: 70188 / 100000
Usage: 70%
$ ~/openclaw/skills/context-manager/compress.sh summarize agent:main:main
🧠 Requesting AI summary for session: agent:main:main
Session ID: fc192a2d-091c-48c7-9fad-12bf34687454
✅ AI Summary generated!
Saved to: memory/compressed/20260127-123146.ai-summary.md
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
### Session Summary: January 27, 2026
#### 1. What was accomplished
- System audit completed
- Essay generation with sub-agents
...
$ ~/openclaw/skills/context-manager/compress.sh summarize agent:main:main --replace
🧠 Requesting AI summary for session: agent:main:main
Session ID: fc192a2d-091c-48c7-9fad-12bf34687454
Mode: REPLACE (will reset session after summary)
✅ AI Summary generated!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[AI-generated summary displayed]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔄 Resetting session and injecting compressed context...
Backing up session file...
Backup saved: memory/compressed/20260127-123146.session-backup.jsonl
Deleting session JSONL to reset...
Injecting compressed context into fresh session...
✅ Session compressed successfully!
Old session ID: fc192a2d-091c-48c7-9fad-12bf34687454
New session ID: a1b2c3d4-...
Session is ready to continue with compressed context
Result: 70k tokens → 16k tokens (77% reduction)
When compression occurs, these files are created in memory/compressed/:
| File | Description |
|---|---|
{timestamp}.ai-summary.md | AI-generated session summary |
{timestamp}.session-backup.jsonl | Full backup of original session (can restore if needed) |
{timestamp}.transcript.md | Raw transcript extraction (legacy) |
{timestamp}.summary.md | Grep-based summary (legacy) |
brew install jq)openclaw agent and openclaw sessionsThe script uses JSONL deletion to reset sessions (official method):
memory/compressed/~/.openclaw/agents/{agent}/sessions/{sessionId}.jsonlopenclaw agent --to mainThe /reset slash command only works in the chat interface. When sent via openclaw agent --session-id, it's treated as a regular message and the agent tries to interpret it as a task.
The script asks the agent to provide:
If the AI summary extraction fails, check stderr redirect:
# The script uses 2>/dev/null to avoid Node deprecation warnings breaking JSON
openclaw agent --session-id $ID -m "..." --json 2>/dev/null
Verify the JSONL file path:
ls ~/.openclaw/agents/main/sessions/
If something goes wrong:
cp memory/compressed/{timestamp}.session-backup.jsonl \
~/.openclaw/agents/main/sessions/{sessionId}.jsonl
Use openclaw logs to troubleshoot:
openclaw logs --limit 50 --json | grep -i "error\|fail"
summarize without --replace first to verify the summary qualitystatus to verify compression workedopenclaw sessions --helpopenclaw agent --help