clawdscan
✓Verified·Scanned 2/17/2026
Clawdscan analyzes Clawdbot/OpenClaw session JSONL files, reports bloat/zombies/stale sessions, and offers cleanup and heartbeat integration. The package includes explicit run commands (e.g., clawdscan scan, python3 clawdscan.py) that execute the tool and can move session files during cleanup.
from clawhub.ai·vd69d4c9·74.1 KB·0 installs
Scanned from 0.2.1 at d69d4c9 · Transparency log ↗
$ vett add clawhub.ai/cheenu1092-oss/clawdscan
<p align="center">
<img src="assets/logo.png" alt="clawdscan logo" width="200" />
</p>
ClawdScan - Clawdbot Session Health Analyzer 🔍
A comprehensive diagnostic tool for Clawdbot sessions. Analyze JSONL session files to identify performance issues, bloated sessions, zombie processes, and get actionable cleanup recommendations.
Features
- 🔍 Session Health Analysis - Detect bloated sessions, high message counts, disk usage patterns
- 💀 Zombie Detection - Find sessions created but never used
- 🗓️ Stale Session Identification - Identify sessions inactive for configurable periods
- 📊 Tool Usage Analytics - Track which tools are being used and how frequently
- 🤖 Model Usage Patterns - Monitor model switching and usage trends
- 💾 Disk Space Management - Breakdown of storage usage by agent and session
- 🧹 Automatic Cleanup - Safe archive and deletion of problematic sessions
- 📈 Trend Tracking - Historical analysis of session health over time
- 💓 Heartbeat Integration - Automated monitoring and alerts
Quick Start
# Install as Clawdbot skill
clawdbot skill install clawdscan
# Or run standalone
chmod +x clawdscan.py
./clawdscan.py scan
Example Output
🔍 ClawdScan v0.1.0 — Clawdbot Session Health Analysis
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Overview
Total Sessions: 42
Total Size: 23.4 MB
Agents: main(38), dj(4)
⚠️ Issues Found
🔥 Bloated: 3 sessions (>1MB or >300 msgs)
💀 Zombies: 2 sessions (created but unused)
🗓️ Stale: 7 sessions (inactive >7 days)
🔝 Top Sessions by Size
1. main-20240108-143022 4.2 MB (1,247 msgs)
2. main-20240107-091534 2.8 MB (892 msgs)
3. dj-20240105-220145 1.9 MB (734 msgs)
💡 Recommendations
• Archive 2 zombie sessions → save 145 KB
• Clean 7 stale sessions → save 3.2 MB
• Consider shorter session lifetimes
Available Commands
| Command | Description | Example |
|---|---|---|
scan | Full health scan | clawdscan scan |
top | Top sessions by size/messages | clawdscan top -n 10 |
inspect | Deep-inspect specific session | clawdscan inspect session-id |
tools | Tool usage analytics | clawdscan tools |
models | Model usage patterns | clawdscan models |
disk | Disk usage breakdown | clawdscan disk |
clean | Safe session cleanup | clawdscan clean --zombies |
history | Health trends over time | clawdscan history --days 7 |
Installation
As Clawdbot Skill
# Install from skill repository
clawdbot skill install clawdscan
# Or install from local directory
cd /path/to/clawdscan
clawdbot skill link .
Standalone Installation
# Make executable
chmod +x clawdscan.py
# Add to PATH (optional)
ln -s $(pwd)/clawdscan.py /usr/local/bin/clawdscan
# Test installation
clawdscan --version
Package Structure
clawdscan/
├── clawdscan.py # Main executable
├── skill.json # Clawdbot skill metadata
├── SKILL.md # Complete documentation
├── LICENSE # MIT license
├── heartbeat-integration.md # Heartbeat integration guide
├── TASK.md # Development task spec
└── README.md # This file
Development
Testing
# Test against live sessions
clawdscan scan
# Test all commands
clawdscan top -n 5
clawdscan history --days 7
clawdscan disk
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Integration Examples
Heartbeat Monitoring
# Add to HEARTBEAT.md
clawdscan scan --json /tmp/health.json
if [[ $(jq '.bloated_sessions | length' /tmp/health.json) -gt 5 ]]; then
echo "🔥 Bloated sessions detected - cleanup needed"
fi
Cron Jobs
# Daily health check
0 2 * * * clawdscan scan --json /var/log/clawdscan-$(date +\%Y\%m\%d).json
# Weekly cleanup
0 3 * * 0 clawdscan clean --stale-days 14 --execute
Python Integration
import subprocess
import json
result = subprocess.run(['clawdscan', 'scan', '--json', '/tmp/scan.json'])
with open('/tmp/scan.json') as f:
data = json.load(f)
if len(data['bloated_sessions']) > 5:
notify_admin("Clawdbot cleanup needed")
Configuration
Environment Variables
CLAWDBOT_DIR- Override default Clawdbot directoryNO_COLOR- Disable colored outputCLAWDSCAN_AUTO_CLEANUP- Enable automatic cleanup
Thresholds (customizable)
- Bloat Size: 1 MB
- Bloat Messages: 300
- Stale Threshold: 7 days
- Zombie Threshold: 48 hours
Addresses
This tool addresses GitHub Issue #1808 - Clawdbot session bloat and disk usage management.
License
MIT License - see LICENSE for details.
Support
- 📖 Documentation: SKILL.md
- 🐛 Issues: GitHub Issues
- 💬 Community: Clawdbot Discord server
Version 0.1.0 - Built with ❤️ for the Clawdbot community