Memory Compression System v3.0
Integrated memory management and extreme context compression for OpenClaw. Combines the best features of memory management and extreme compression into a single, streamlined skill with automatic scheduling.
Quick Start
CODEBLOCK0
Features
1. Integrated Memory Management
- - Automatic compression: Every 6 hours (00:00, 06:00, 12:00, 18:00 UTC)
- Smart cleanup: Daily cleanup of old files
- Search functionality: Unified search across all memory files
- Backup system: Automatic backups before compression
2. Three Compression Formats
- - Base64 Compact (B64C): Universal compatibility, ~40% reduction
- Custom Binary (CBIN): Optimized binary, ~70% reduction
- Ultra Compact (UCMP): Extreme compression, ~85% reduction, target ~150 tokens
3. Automated Scheduling
- - Single cron job: No overlapping schedules
- Configurable: Adjust frequency and timing
- Reliable: Built-in error recovery and logging
- Efficient: Minimal resource usage
4. Search & Retrieval
- - Unified search: Across all memory formats
- Fast indexing: Real-time search updates
- Context aware: Understands compressed formats
- Export options: Search results in multiple formats
5. ClawHub Ready
- - Standard structure: Compatible with ClawHub
- Easy installation: One-command setup
- Health checks: Built-in monitoring
- Documentation: Comprehensive guides
Installation
Via ClawHub (Recommended)
CODEBLOCK1
Manual Installation
CODEBLOCK2
Usage
Basic Operations
CODEBLOCK3
Compression Operations
CODEBLOCK4
Search Operations
CODEBLOCK5
Management Operations
CODEBLOCK6
Configuration
Main Configuration File
Edit
config/default.conf:
CODEBLOCK7
Environment Variables
CODEBLOCK8
Compression Formats
Format 1: Base64 Compact (B64C)
CODEBLOCK9
Features:
- - Human readable
- Easy debugging
- Universal compatibility
- CRC32 integrity check
Format 2: Custom Binary (CBIN)
CODEBLOCK10
Features:
- - Optimized binary format
- Shared string dictionary
- Huffman encoding
- CRC16 integrity check
Format 3: Ultra Compact (UCMP)
Target: ~150 tokens for complete context
Features:
- - Extreme compression (~85% reduction)
- 3-letter abbreviations
- Bit packing
- Delta encoding
- String interning
Automatic Scheduling
Compression Schedule
- - Every 6 hours: 00:00, 06:00, 12:00, 18:00 UTC
- Operations:
1. Backup current memory
2. Compress with optimal format
3. Update search index
4. Cleanup old files
5. Log results
Cleanup Schedule
- - Daily at 04:00 UTC
- Operations:
1. Remove files older than RETENTION_DAYS
2. Archive logs
3. Optimize search index
4. Update statistics
Health Check Schedule
- - Integrated with OpenClaw health checks
- Operations:
1. Check compression status
2. Verify file integrity
3. Monitor resource usage
4. Report issues
Search System
Search Index
- - Real-time updates: Index updates after each compression
- Multiple formats: Searches across all compression formats
- Fast retrieval: Optimized for speed
- Context aware: Understands compressed content
Search Features
CODEBLOCK11
Search Index Structure
CODEBLOCK12
Error Handling & Recovery
Automatic Recovery
- - Backup system: Automatic backups before operations
- Transaction logs: All operations logged
- Rollback capability: Automatic rollback on failure
- Error notifications: Alerts for critical issues
Manual Recovery
CODEBLOCK13
Common Issues & Solutions
Issue: Compression fails
Solution: Check disk space and run INLINECODE1
Issue: Search not working
Solution: Rebuild index with INLINECODE2
Issue: Cron job not running
Solution: Check with INLINECODE3
Issue: Performance degradation
Solution: Run INLINECODE4
Monitoring & Logging
Log Files
- -
logs/compression.log: Compression operations - INLINECODE6 : Search operations
- INLINECODE7 : Error messages
- INLINECODE8 : Performance metrics
- INLINECODE9 : Cron job execution
Status Monitoring
CODEBLOCK14
Alert System
- - Email alerts: For critical errors (if configured)
- Telegram notifications: For important events
- Log monitoring: Automatic log analysis
- Performance alerts: For resource issues
Testing
Test Suite
CODEBLOCK15
Test Coverage
- - Unit tests: Format encoding/decoding
- Integration tests: Full system integration
- Performance tests: Speed and memory usage
- Error tests: Failure scenarios
- Cron tests: Automatic scheduling
Manual Testing
CODEBLOCK16
Performance
Compression Performance
- - Base64: < 50ms for 10KB
- Binary: < 100ms for 10KB
- Ultra: < 200ms for 10KB
- Target ratio: 75-90% reduction
Search Performance
- - Indexing: < 100ms per file
- Search: < 50ms for 1000 files
- Memory: < 10MB for index
- Updates: Real-time
Resource Usage
- - CPU: Minimal impact
- Memory: < 50MB peak
- Disk: Configurable retention
- Network: Local only
Updates & Maintenance
Update Procedure
CODEBLOCK17
Backup Recommendations
- - Regular backups: Weekly backups of
data/ directory - Export search index: Monthly export of search index
- Archive logs: Monthly log archiving
- Configuration backup: Backup
config/ after changes
Version History
- - 3.0.0: Integrated memory-compression-system (current)
- 2.0.0: Extreme context compression skill
- 1.0.0: Memory manager skill
Contributing
Development Setup
CODEBLOCK18
Code Standards
- - Bash scripts: Follow Google Bash Style Guide
- JavaScript: Follow Standard JS style
- Documentation: Keep SKILL.md updated
- Testing: Add tests for new features
Pull Request Process
- 1. Fork the repository
- Create feature branch
- Add tests for new functionality
- Update documentation
- Submit pull request
Support
Documentation
- - SKILL.md: This file
- README.md: User documentation
- examples/: Usage examples
- test/: Test examples
Troubleshooting
- 1. Check
logs/ directory - Run INLINECODE13
- Review INLINECODE14
- Contact maintainer if needed
Community
- - ClawHub: Skill repository
- Discord: OpenClaw community
- GitHub: Issue tracker
- Documentation: OpenClaw docs
License
MIT License - See LICENSE file for details.
Note: This skill is designed for OpenClaw context optimization. Always maintain backups of important data and test in a safe environment before production use.