Context Compressor Skill Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session. When to Use - Long coding sessions with extensive context accumulation - Projects with many iterations and refinements - When noticing Claude repeating itself or losing track of details - Proactively before hitting hard context limits - During heartbeats or idle moments when user isn't actively waiting How It Works 1. Monitoring : Continuously tracks context usage via session metadata 2…

\\033[0;31m'\nGREEN=

Context Compressor Skill Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session. When to Use - Long coding sessions with extensive context accumulation - Projects with many iterations and refinements - When noticing Claude repeating itself or losing track of details - Proactively before hitting hard context limits - During heartbeats or idle moments when user isn't actively waiting How It Works 1. Monitoring : Continuously tracks context usage via session metadata 2…

\\033[0;32m'\nYELLOW=

Context Compressor Skill Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session. When to Use - Long coding sessions with extensive context accumulation - Projects with many iterations and refinements - When noticing Claude repeating itself or losing track of details - Proactively before hitting hard context limits - During heartbeats or idle moments when user isn't actively waiting How It Works 1. Monitoring : Continuously tracks context usage via session metadata 2…

\\033[1;33m'\nNC=

Context Compressor Skill Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session. When to Use - Long coding sessions with extensive context accumulation - Projects with many iterations and refinements - When noticing Claude repeating itself or losing track of details - Proactively before hitting hard context limits - During heartbeats or idle moments when user isn't actively waiting How It Works 1. Monitoring : Continuously tracks context usage via session metadata 2…

\\033[0m'\n\n# Ensure compressed memory directory exists\nmkdir -p \"$COMPRESSED_DIR\"\n\n# Load configuration\nload_config() {\n if [[ -f \"$CONFIG_FILE\" ]]; then\n THRESHOLD=$(jq -r '.threshold // env.DEFAULT_THRESHOLD' \"$CONFIG_FILE\" 2>/dev/null || echo \"$DEFAULT_THRESHOLD\")\n DEPTH=$(jq -r '.depth // env.DEFAULT_DEPTH' \"$CONFIG_FILE\" 2>/dev/null || echo \"$DEFAULT_DEPTH\")\n QUIET_HOURS=$(jq -r '.quiet_hours // \"\"' \"$CONFIG_FILE\" 2>/dev/null || echo \"\")\n else\n THRESHOLD=$DEFAULT_THRESHOLD\n DEPTH=$DEFAULT_DEPTH\n QUIET_HOURS=\"\"\n fi\n}\n\n# Save configuration\nsave_config() {\n load_config\n cat > \"$CONFIG_FILE\" \u003c\u003cEOF\n{\n \"threshold\": $THRESHOLD,\n \"depth\": \"$DEPTH\",\n \"quiet_hours\": \"$QUIET_HOURS\",\n \"last_compression\": \"$(date -Iseconds 2>/dev/null || echo \"\")\",\n \"total_compressions\": $((TOTAL_COMPRESSIONS + 1))\n}\nEOF\n}\n\n# Get current session info (simulated - adapt to actual Clawdbot metrics)\nget_session_info() {\n # This would integrate with Clawdbot's session API\n # For now, returns estimated values\n SESSION_ID=$(cat /proc/self/cgroup 2>/dev/null | head -1 | md5sum | cut -c1-8 || echo \"unknown\")\n CURRENT_TOKENS=${CURRENT_TOKENS:-50000}\n MAX_TOKENS=${MAX_TOKENS:-100000}\n}\n\n# Calculate context usage percentage\ncalculate_usage() {\n get_session_info\n USAGE=$((CURRENT_TOKENS * 100 / MAX_TOKENS))\n echo \"$USAGE\"\n}\n\n# Check if we're in quiet hours\nin_quiet_hours() {\n if [[ -z \"$QUIET_HOURS\" ]]; then\n return 1\n fi\n \n local current_hour=$(date +%H)\n local start=$(echo \"$QUIET_HOURS\" | cut -d'-' -f1)\n local end=$(echo \"$QUIET_HOURS\" | cut -d'-' -f2)\n \n if [[ \"$current_hour\" -ge \"$start\" ]] && [[ \"$current_hour\" -lt \"$end\" ]]; then\n return 0\n fi\n return 1\n}\n\n# Extract key decisions from conversation\nextract_decisions() {\n local transcript=\"$1\"\n local output=\"$2\"\n \n # Look for decision markers\n grep -i \"decided\\|decision\\|chose\\|chose to\\|we'll\\|we're going\\|let's go with\\|i'll use\\|using\" \"$transcript\" 2>/dev/null | \\\n grep -v \"let me know\\|feel free to\\|you might want\" | \\\n head -20 > \"$output.decisions.tmp\" || true\n \n if [[ -s \"$output.decisions.tmp\" ]]; then\n echo -e \"\\n## Key Decisions\" >> \"$output\"\n cat \"$output.decisions.tmp\" >> \"$output\"\n rm \"$output.decisions.tmp\"\n fi\n}\n\n# Extract file modifications\nextract_files() {\n local transcript=\"$1\"\n local output=\"$2\"\n \n # Look for file operations\n grep -E \"(created|modified|edited|updated|deleted|changed)\" \"$transcript\" 2>/dev/null | \\\n grep -E \"\\.(tsx|ts|jsx|js|py|md|json|yaml|yml|css|html|svelte)$\" | \\\n head -15 > \"$output.files.tmp\" || true\n \n if [[ -s \"$output.files.tmp\" ]]; then\n echo -e \"\\n## File Modifications\" >> \"$output\"\n cat \"$output.files.tmp\" >> \"$output\"\n rm \"$output.files.tmp\"\n fi\n}\n\n# Extract code snippets\nextract_code() {\n local transcript=\"$1\"\n local output=\"$2\"\n \n # Extract code blocks (simple heuristic)\n grep -A5 '```' \"$transcript\" 2>/dev/null | head -100 > \"$output.code.tmp\" || true\n \n if [[ -s \"$output.code.tmp\" ]]; then\n echo -e \"\\n## Code Snippets\" >> \"$output\"\n cat \"$output.code.tmp\" >> \"$output\"\n rm \"$output.code.tmp\"\n fi\n}\n\n# Extract pending tasks\nextract_todos() {\n local transcript=\"$1\"\n local output=\"$2\"\n \n grep -i \"todo\\|to-do\\|pending\\|still need\\|remaining\\|next step\" \"$transcript\" 2>/dev/null | \\\n head -10 > \"$output.todos.tmp\" || true\n \n if [[ -s \"$output.todos.tmp\" ]]; then\n echo -e \"\\n## Pending Tasks\" >> \"$output\"\n cat \"$output.todos.tmp\" >> \"$output\"\n rm \"$output.todos.tmp\"\n fi\n}\n\n# Generate executive summary\ngenerate_summary() {\n local transcript=\"$1\"\n local session_id=\"$2\"\n local output=\"$3\"\n \n local timestamp=$(date -Iseconds 2>/dev/null || date)\n \n cat > \"$output\" \u003c\u003cEOF\n# Session Summary - $session_id\nGenerated: $timestamp\n\n## Executive Summary\nAutomated context compression summary for session handoff.\n\n## Session Context\nEOF\n \n # Add current working directory and key files\n echo \"- Working Directory: $(pwd)\" >> \"$output\"\n echo \"- Git Status:\" >> \"$output\"\n git status --short 2>/dev/null | head -10 >> \"$output\" || echo \" (Not a git repository)\" >> \"$output\"\n \n # Extract key information\n extract_decisions \"$transcript\" \"$output\"\n extract_files \"$transcript\" \"$output\"\n extract_code \"$transcript\" \"$output\"\n extract_todos \"$transcript\" \"$output\"\n \n # Add recent git commits as timeline\n echo -e \"\\n## Recent Activity\" >> \"$output\"\n git log --oneline -10 2>/dev/null >> \"$output\" || echo \" No git history\" >> \"$output\"\n \n echo -e \"\\n## Continuation Notes\" >> \"$output\"\n echo \"This summary was automatically generated to preserve context across session handoff.\" >> \"$output\"\n echo \"For full details, see: $COMPRESSED_DIR/$session_id.transcript.md\" >> \"$output\"\n}\n\n# Main compression function\ncompress_session() {\n echo -e \"${YELLOW}🧠 Starting context compression...${NC}\"\n \n local session_id=$(date +%Y%m%d-%H%M%S)\n local transcript_file=\"$COMPRESSED_DIR/$session_id.transcript.md\"\n local summary_file=\"$COMPRESSED_DIR/$session_id.summary.md\"\n \n # In a real implementation, this would:\n # 1. Fetch current session transcript via Clawdbot API\n # 2. Analyze and score conversation turns\n # 3. Preserve high-signal content, summarize low-signal\n # 4. Generate handoff package\n \n # For now, create placeholder indicating skill is ready\n cat > \"$transcript_file\" \u003c\u003cEOF\n# Session Transcript - $session_id\nTimestamp: $(date -Iseconds)\n\n[This is a placeholder - in production, this would contain the actual session transcript]\n\n## Session Statistics\n- Context Usage: ${USAGE:-0}%\n- Threshold: ${THRESHOLD}%\n- Compression Depth: ${DEPTH}\nEOF\n \n # Generate summary\n generate_summary \"$transcript_file\" \"$session_id\" \"$summary_file\"\n \n echo -e \"${GREEN}✅ Compression complete!${NC}\"\n echo \" - Transcript: $transcript_file\"\n echo \" - Summary: $summary_file\"\n \n # Trigger session handoff (in production)\n # handoff_to_new_session \"$session_id\"\n \n return 0\n}\n\n# Status command\ncmd_status() {\n load_config\n \n echo \"📊 Context Compressor Status\"\n echo \"━━━━━━━━━━━━━━━━━━━━━━━━━━━━\"\n echo \" Threshold: ${THRESHOLD}%\"\n echo \" Depth: ${DEPTH}\"\n echo \" Quiet Hours: ${QUIET_HOURS:-None}\"\n \n local usage=$(calculate_usage)\n echo \" Current Usage: ${usage}%\"\n \n if [[ -d \"$COMPRESSED_DIR\" ]]; then\n local compressions=$(ls -1 \"$COMPRESSED_DIR\"/*.summary.md 2>/dev/null | wc -l)\n echo \" Total Compressions: $compressions\"\n fi\n \n if [[ \"$usage\" -ge \"$THRESHOLD\" ]]; then\n echo -e \"\\n${YELLOW}⚠️ Context usage above threshold!${NC}\"\n echo \" Run 'context-compressor compress' to compress and reset.\"\n else\n echo -e \"\\n${GREEN}✓ Context usage normal${NC}\"\n fi\n}\n\n# Set threshold\ncmd_set_threshold() {\n local new_threshold=\"${1:-80}\"\n \n if [[ \"$new_threshold\" -lt 50 ]] || [[ \"$new_threshold\" -gt 99 ]]; then\n echo -e \"${RED}Error: Threshold must be between 50 and 99${NC}\"\n exit 1\n fi\n \n THRESHOLD=$new_threshold\n save_config\n echo -e \"${GREEN}✅ Threshold set to ${THRESHOLD}%${NC}\"\n}\n\n# Set depth\ncmd_set_depth() {\n local new_depth=\"${1:-balanced}\"\n \n if [[ \"$new_depth\" != \"brief\" ]] && [[ \"$new_depth\" != \"balanced\" ]] && [[ \"$new_depth\" != \"comprehensive\" ]]; then\n echo -e \"${RED}Error: Depth must be brief, balanced, or comprehensive${NC}\"\n exit 1\n fi\n \n DEPTH=$new_depth\n save_config\n echo -e \"${GREEN}✅ Depth set to ${DEPTH}${NC}\"\n}\n\n# Set quiet hours\ncmd_set_quiet_hours() {\n local range=\"${1:-}\"\n \n if [[ -z \"$range\" ]]; then\n QUIET_HOURS=\"\"\n echo -e \"${GREEN}✅ Quiet hours disabled${NC}\"\n else\n # Validate format HH:00-HH:00\n if ! [[ \"$range\" =~ ^[0-2][0-9]:00-[0-2][0-9]:00$ ]]; then\n echo -e \"${RED}Error: Format must be HH:00-HH:00 (e.g., 23:00-07:00)${NC}\"\n exit 1\n fi\n QUIET_HOURS=$range\n echo -e \"${GREEN}✅ Quiet hours set to ${QUIET_HOURS}${NC}\"\n fi\n \n save_config\n}\n\n# Force compression\ncmd_compress() {\n load_config\n \n if in_quiet_hours; then\n echo -e \"${YELLOW}⏸️ In quiet hours (${QUIET_HOURS}). Compression skipped.${NC}\"\n exit 0\n fi\n \n compress_session\n}\n\n# Check and compress if needed\ncmd_check() {\n load_config\n \n local usage=$(calculate_usage)\n \n echo \"Context usage: ${usage}% (threshold: ${THRESHOLD}%)\"\n \n if in_quiet_hours; then\n echo \"In quiet hours - skipping compression check.\"\n exit 0\n fi\n \n if [[ \"$usage\" -ge \"$THRESHOLD\" ]]; then\n echo -e \"${YELLOW}⚠️ Context above threshold. Compressing...${NC}\"\n compress_session\n else\n echo -e \"${GREEN}✓ Context within limits${NC}\"\n fi\n}\n\n# Main command routing\ncase \"${1:-status}\" in\n status)\n cmd_status\n ;;\n compress)\n cmd_compress\n ;;\n check)\n cmd_check\n ;;\n set-threshold)\n cmd_set_threshold \"${2:-}\"\n ;;\n set-depth)\n cmd_set_depth \"${2:-}\"\n ;;\n set-quiet-hours)\n cmd_set_quiet_hours \"${2:-}\"\n ;;\n *)\n echo \"Context Compressor - Automated context management\"\n echo \"\"\n echo \"Usage: $0 \u003ccommand> [arguments]\"\n echo \"\"\n echo \"Commands:\"\n echo \" status Show current status and configuration\"\n echo \" compress Force compression and session handoff\"\n echo \" check Check and compress if needed\"\n echo \" set-threshold N Set compression threshold (50-99, default: 80)\"\n echo \" set-depth LEVEL Set summarization depth (brief/balanced/comprehensive)\"\n echo \" set-quiet-hours HH Set quiet hours range (e.g., '23:00-07:00')\"\n exit 1\n ;;\nesac\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":10729,"content_sha256":"ee89d263800075905810cb1c55525b3061c19a8dc6c8710670771383c2d7d55e"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Context Compressor Skill","type":"text"}]},{"type":"paragraph","content":[{"text":"Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Long coding sessions with extensive context accumulation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Projects with many iterations and refinements","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"When noticing Claude repeating itself or losing track of details","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Proactively before hitting hard context limits","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"During heartbeats or idle moments when user isn't actively waiting","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"How It Works","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Monitoring","type":"text","marks":[{"type":"strong"}]},{"text":": Continuously tracks context usage via session metadata","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compression","type":"text","marks":[{"type":"strong"}]},{"text":": When threshold reached (configurable, default 80%), summarizes old messages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preservation","type":"text","marks":[{"type":"strong"}]},{"text":": Extracts key decisions, code changes, file states, and action items","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Handoff","type":"text","marks":[{"type":"strong"}]},{"text":": Initiates new session with compressed context as foundation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Continuity","type":"text","marks":[{"type":"strong"}]},{"text":": User experiences seamless transition with all important context preserved","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Key Features","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Smart Summarization","type":"text","marks":[{"type":"strong"}]},{"text":": Preserves decisions, code, file states, not just raw text","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Configurable Thresholds","type":"text","marks":[{"type":"strong"}]},{"text":": Set when compression triggers (70-90% of context limit)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Background Operation","type":"text","marks":[{"type":"strong"}]},{"text":": Works during heartbeats or low-activity periods","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Selective Retention","type":"text","marks":[{"type":"strong"}]},{"text":": Keeps important files, decisions, TODOs; compresses chaff","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Session State Transfer","type":"text","marks":[{"type":"strong"}]},{"text":": New session inherits all critical context automatically","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Concepts","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Context Degradation Patterns","type":"text"}]},{"type":"paragraph","content":[{"text":"As sessions grow long, watch for these signs:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Repetitive responses (\"As I mentioned earlier...\")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Missing references to earlier decisions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Forgetting file modifications","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Asking to repeat information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"General coherence degradation","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Compression Strategy","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Extract Core Intelligence","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"All decisions made and their rationale","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File paths and their current state","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Pending tasks and their status","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Important code snippets or configurations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User preferences and patterns","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Condense History","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Remove filler, backtracking, dead ends","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep only high-signal turns","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Merge related iterations into summaries","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preserve critical code snippets inline","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Format for Efficiency","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use compact representations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Reference files rather than dump contents","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"List decisions as bullet points","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Include only relevant code context","type":"text"}]}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Usage","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Automatic Mode (Recommended)","type":"text"}]},{"type":"paragraph","content":[{"text":"The skill runs automatically during heartbeats and idle periods. Configure threshold:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Set compression to trigger at 75% context usage\ncontext-compressor set-threshold 75\n\n# Check current status\ncontext-compressor status","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Manual Trigger","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Force compression and session reset\ncontext-compressor compress --force","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Configuration","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# View all settings\ncontext-compressor config\n\n# Adjust summarization depth\ncontext-compressor set-depth brief|detailed|comprehensive\n\n# Set quiet hours (compression won't run)\ncontext-compressor set-quiet-hours 23:00-07:00","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Output","type":"text"}]},{"type":"paragraph","content":[{"text":"When compression occurs, the skill produces:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Summary File","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"memory/compressed-{session-id}.md","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Executive summary of session","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Key decisions made","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Files modified and their states","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Pending tasks","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Code snippets worth preserving","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Session Handoff","type":"text","marks":[{"type":"strong"}]},{"text":": Automatic new session with:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User context (USER.md)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Project memory (MEMORY.md)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compressed session summary","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Current working state","type":"text"}]}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Regular Compression","type":"text","marks":[{"type":"strong"}]},{"text":": Don't wait for limits. Compress proactively every few hours","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preserve Code","type":"text","marks":[{"type":"strong"}]},{"text":": Always keep actual code snippets, not just references","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Track Decisions","type":"text","marks":[{"type":"strong"}]},{"text":": Explicitly note WHY decisions were made, not just WHAT","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep TODOs","type":"text","marks":[{"type":"strong"}]},{"text":": Mark incomplete work clearly for continuity","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Reference Files","type":"text","marks":[{"type":"strong"}]},{"text":": Point to files rather than embedding full contents","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Integration Points","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Heartbeats","type":"text","marks":[{"type":"strong"}]},{"text":": Runs compression checks during heartbeat cycles","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Memory System","type":"text","marks":[{"type":"strong"}]},{"text":": Writes compressed summaries to memory files","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Session Management","type":"text","marks":[{"type":"strong"}]},{"text":": Coordinates with session spawn for handoff","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File Tracking","type":"text","marks":[{"type":"strong"}]},{"text":": References current file states accurately","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Technical Details","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Compression Algorithm","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Parse session transcript into atomic turns","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Score each turn for importance (decisions = high, chat = low)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep top N% of turns by importance score","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Summarize remaining turns into executive summary","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Extract and preserve code blocks separately","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Generate session transfer package","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Thresholds","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Conservative (70%)","type":"text","marks":[{"type":"strong"}]},{"text":": Trigger early, preserve more context","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Balanced (80%)","type":"text","marks":[{"type":"strong"}]},{"text":": Default, good for most workflows","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Aggressive (90%)","type":"text","marks":[{"type":"strong"}]},{"text":": Push limits, maximum session length","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Manual Only","type":"text","marks":[{"type":"strong"}]},{"text":": Disable auto-trigger, compress on demand","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"File References","type":"text"}]},{"type":"paragraph","content":[{"text":"The compressor tracks:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Modified files and their paths","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Configuration changes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"New files created","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Deleted files","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Directory structure changes","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Troubleshooting","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Compression Too Frequent","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Increase threshold\ncontext-compressor set-threshold 85","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Context Lost After Handoff","type":"text"}]},{"type":"paragraph","content":[{"text":"Check that:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compressed summary was generated (","type":"text"},{"text":"memory/compressed-*.md","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"New session loaded memory files","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Critical files weren't in the \"chaff\" that got dropped","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Performance Impact","type":"text"}]},{"type":"paragraph","content":[{"text":"Compression runs in background and should complete in \u003c30s for typical sessions. If slower:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Reduce summarization depth","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Increase threshold to compress less frequently","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Exclude large files from compression scope","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Examples","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Typical Workflow","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"User: Working on notes app sidebar\n[Session runs 2 hours, many iterations]\n\nHeartbeat triggers → Context at 78% → Auto-compress → New session\nUser: (no interruption, seamless continuation)\nNew session has: executive summary, key decisions, file states, TODOs","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Manual Recovery","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"User notices Claude repeating itself\nUser: \"context-compressor compress --force\"\nCompressor summarizes → New session starts → User continues seamlessly","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Related Skills","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"memory-system","type":"text","marks":[{"type":"strong"}]},{"text":": Underlying memory infrastructure","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"self-improving-agent","type":"text","marks":[{"type":"strong"}]},{"text":": Learns from session patterns","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"sessions-spawn","type":"text","marks":[{"type":"strong"}]},{"text":": Handles new session creation","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"See Also","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Context Engineering Skills Collection","type":"text","marks":[{"type":"link","attrs":{"href":"https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Research on \"lost-in-the-middle\" phenomenon in LLM context windows","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"context-compressor","author":"@skillopedia","source":{"stars":609,"repo_name":"awesome-openclaw-skills","origin_url":"https://github.com/sundial-org/awesome-openclaw-skills/blob/HEAD/skills/context-compressor/SKILL.md","repo_owner":"sundial-org","body_sha256":"d72dec4caa9419b875ee9965937605dd8d83d520fee49d90ba0a5fce98ad049b","cluster_key":"4099b8f997dec086174e0f2a242281329c702cb0eac7b73a99c2b17b1dea9668","clean_bundle":{"format":"clean-skill-bundle-v1","source":"sundial-org/awesome-openclaw-skills/skills/context-compressor/SKILL.md","attachments":[{"id":"f583b85c-d0b7-5add-ad63-d712230e6334","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/f583b85c-d0b7-5add-ad63-d712230e6334/attachment.sh","path":"scripts/compress.sh","size":10729,"sha256":"ee89d263800075905810cb1c55525b3061c19a8dc6c8710670771383c2d7d55e","contentType":"application/x-sh; charset=utf-8"}],"bundle_sha256":"541cfad0e9648cec2b4f8291946127da81c68b24944a5a7fc55f86aae494d331","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/context-compressor/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"general","category_label":"General"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"general","import_tag":"clean-skills-v1"}},"renderedAt":1782986432877}

Context Compressor Skill Automated context management for long-running Clawdbot sessions. Detects when context limits approach, compresses old conversation history, and seamlessly transfers to a fresh session. When to Use - Long coding sessions with extensive context accumulation - Projects with many iterations and refinements - When noticing Claude repeating itself or losing track of details - Proactively before hitting hard context limits - During heartbeats or idle moments when user isn't actively waiting How It Works 1. Monitoring : Continuously tracks context usage via session metadata 2…