From sundial-org-awesome-openclaw-skills-4
Manages Clawdbot/Moltbot agent session context via bash scripts: lists usage, generates AI summaries, compresses by resetting and injecting summaries. Use when nearing 70-80% context usage.
npx claudepluginhub joshuarweaver/cascade-ai-ml-agents-misc-2 --plugin sundial-org-awesome-openclaw-skills-4This skill uses the workspace's default tool permissions.
AI-powered context management for Clawdbot/Moltbot sessions. Uses the agent itself to generate intelligent summaries, then resets the session with compressed context.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
AI-powered context management for Clawdbot/Moltbot sessions. Uses the agent itself to generate intelligent summaries, then resets the session with compressed context.
# List all sessions with usage stats
~/clawd/skills/context-manager/compress.sh list
# Check status of a specific session
~/clawd/skills/context-manager/compress.sh status agent:main:main
# Generate AI summary (read-only, safe)
~/clawd/skills/context-manager/compress.sh summarize agent:main:main
# Compress session: generate summary, reset, inject (DESTRUCTIVE)
~/clawd/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 |
$ ~/clawd/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%
$ ~/clawd/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%
$ ~/clawd/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
...
$ ~/clawd/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)clawdbot agent and clawdbot sessionsThe script uses JSONL deletion to reset sessions (official method per Moltbot docs):
memory/compressed/~/.clawdbot/agents/{agent}/sessions/{sessionId}.jsonlclawdbot agent --to mainThe /reset slash command only works in the chat interface. When sent via clawdbot 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
clawdbot agent --session-id $ID -m "..." --json 2>/dev/null
Verify the JSONL file path:
ls ~/.clawdbot/agents/main/sessions/
If something goes wrong:
cp memory/compressed/{timestamp}.session-backup.jsonl \
~/.clawdbot/agents/main/sessions/{sessionId}.jsonl
Use clawdbot logs to troubleshoot:
clawdbot logs --limit 50 --json | grep -i "error\|fail"
summarize without --replace first to verify the summary qualitystatus to verify compression workedclawdbot sessions --helpclawdbot agent --help