[](https://clawhub.ai/skills/clawdscan) [](https://opensource.org/licenses/MIT) [](https://github.com/jugaad-lab/clawdscan/stargazers)
**Install via ClawHub:** `clawhub install clawdscan`
β Found this useful? Star this repo to help others discover it!
β Found this useful? Star this repo to help others discover it!
A comprehensive diagnostic tool for Clawdbot sessions. Analyze JSONL session files to identify performance issues, bloated sessions, zombie processes, and get actionable cleanup recommendations.
π If you find this useful, please β star this repo! It helps other developers discover session health tools.
- π 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
# Install as Clawdbot skill
clawdbot skill install clawdscan
# Or run standalone
chmod +x clawdscan.py
./clawdscan.py scanπ 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
| 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 |
# Install from skill repository
clawdbot skill install clawdscan
# Or install from local directory
cd /path/to/clawdscan
clawdbot skill link .# Make executable
chmod +x clawdscan.py
# Add to PATH (optional)
ln -s $(pwd)/clawdscan.py /usr/local/bin/clawdscan
# Test installation
clawdscan --versionclawdscan/
βββ 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
# Test against live sessions
clawdscan scan
# Test all commands
clawdscan top -n 5
clawdscan history --days 7
clawdscan disk- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
# 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# 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 --executeimport 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")CLAWDBOT_DIR- Override default Clawdbot directoryNO_COLOR- Disable colored outputCLAWDSCAN_AUTO_CLEANUP- Enable automatic cleanup
- Bloat Size: 1 MB
- Bloat Messages: 300
- Stale Threshold: 7 days
- Zombie Threshold: 48 hours
This tool addresses GitHub Issue #1808 - Clawdbot session bloat and disk usage management.
Found a bug? Have an idea? Open an issue or submit a PR!
If this tool saved you time, please β star this repo β it helps others find it.
MIT License - see LICENSE for details.
- π Documentation: SKILL.md
- π Issues: GitHub Issues
- π¬ Community: Clawdbot Discord server
| Tool | What it does |
|---|---|
| claude-code-mastery | Master Claude Code with subagents & automation |
| tokenmeter | Track AI token usage & costs locally |
| clawguard | Security blacklist for AI agents |
| clawdscan | Session health analyzer for OpenClaw |
| skilldoc | Skill health checker for OpenClaw |
| tribe-protocol | Trust & access control for AI bots |
| discord-voice-plugin | Voice conversations with AI in Discord |
| worldmonitor | Real-time global intelligence dashboard |
β Found these useful? Star the repos you like!
Version 0.1.0 - Built with β€οΈ for the Clawdbot community
