Diagnose Clawdbot/OpenClaw health — session bloat, zombies, stale files, AND skill dependency validation. Zero dependencies, single Python file.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install clawdscan或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install clawdscan⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/clawdscan/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: clawdscan version: 0.3.0 description: "Diagnose Clawdbot/OpenClaw health — session bloat, zombies, stale files, AND skill dependency validation. Zero dependencies, single Python file." user-invocable: true metadata: openclaw: emoji: "🔍" requires: bins: ["python3"] ---
> 🔍 Diagnose bloat, find zombies, reclaim disk space
ClawdScan is a zero-dependency Python CLI that analyzes Clawdbot/OpenClaw session JSONL files to identify bloated sessions, zombies, stale files, and provides actionable cleanup recommendations.
clawdbot skill install clawdscan
chmod +x clawdscan.py
./clawdscan.py --help
# Full health scan
clawdscan scan
# Top 10 largest sessions
clawdscan top -n 10
# Clean up zombie sessions
clawdscan clean --zombies --execute
# View recent trends
clawdscan history --days 7
scan - Full Health ScanComprehensive analysis of all Clawdbot sessions.
clawdscan scan [--json output.json]
# Examples
clawdscan scan # Console output
clawdscan scan --json report.json # Save as JSON
Output includes:
top - Top SessionsShow largest sessions by size or message count.
clawdscan top [-n COUNT] [--sort {size|messages}]
# Examples
clawdscan top # Top 15 by size
clawdscan top -n 20 # Top 20 by size
clawdscan top --sort messages # Top 15 by message count
clawdscan top -n 10 --sort messages # Top 10 by messages
inspect - Deep Session AnalysisDetailed analysis of a specific session.
clawdscan inspect <session-id>
# Example
clawdscan inspect chhotu-agent-20240109
Shows:
tools - Tool Usage AnalyticsAggregate statistics across all sessions.
clawdscan tools
Analysis includes:
models - Model Usage PatternsTrack model usage and switching patterns.
clawdscan models
Shows:
disk - Storage AnalysisBreakdown of disk usage by agent and session type.
clawdscan disk
Provides:
clean - Session CleanupSafe cleanup of problematic sessions with preview mode.
clawdscan clean [--zombies] [--stale-days N] [--execute]
# Examples
clawdscan clean --zombies # Preview zombie cleanup
clawdscan clean --zombies --execute # Execute zombie cleanup
clawdscan clean --stale-days 28 # Preview cleanup of 28+ day old sessions
clawdscan clean --stale-days 28 --execute # Execute stale cleanup
Safety features:
history - Trend Analysis (New)View session health trends over time.
clawdscan history [--days N]
# Examples
clawdscan history # Last 30 days
clawdscan history --days 7 # Last week
clawdscan history --days 90 # Last 3 months
Tracks:
CLAWDBOT_DIR - Override default Clawdbot directoryNO_COLOR - Disable colored outputClawdScan can run automatically as part of Clawdbot's heartbeat system:
### In HEARTBEAT.md
- Check session health every 6 hours
- Alert if >5 bloated sessions found
- Alert if total usage >100MB
- Auto-cleanup zombies (if enabled)
{
"heartbeat": {
"enabled": true,
"interval": "6h",
"auto_cleanup": false,
"alert_thresholds": {
"bloated_sessions": 5,
"total_size": "100MB"
}
}
}
🔍 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
📈 Session Health Trends (Last 30 Days)
Week 1 (Jan 1-7): 12 sessions, 8.4 MB
Week 2 (Jan 8-14): 18 sessions, 15.7 MB 📈 +87% growth
Week 3 (Jan 15-21): 22 sessions, 19.3 MB 📈 +23% growth
Week 4 (Jan 22-28): 28 sessions, 23.4 MB 📈 +21% growth
🔥 Bloat Trend: 0 → 1 → 2 → 3 sessions
💀 Zombie Trend: 1 → 1 → 2 → 2 sessions
💡 Growth Rate: +38% sessions/week, +44% storage/week
"No sessions found"
--dir parameter points to correct Clawdbot directoryagents/*/sessions/"Permission denied"
~/.clawdbot directory"JSON parsing error"
--verbose flag for detailed error infoclawdscan scan --verbose --debug
# Daily health check at 2 AM
0 2 * * * /usr/local/bin/clawdscan scan --json /var/log/clawdscan.json
#!/bin/bash
# Weekly cleanup script
clawdscan clean --zombies --execute
clawdscan clean --stale-days 14 --execute
clawdscan scan --json /var/log/weekly-scan.json
import subprocess
import json
# Run scan and get JSON output
result = subprocess.run(['clawdscan', 'scan', '--json', '/tmp/scan.json'])
with open('/tmp/scan.json') as f:
data = json.load(f)
# Process results
if data['bloated_sessions'] > 5:
notify_admin("ClawdBot cleanup needed")
clawdscan.pyskill.json tools arraySKILL.md--help text...
安装 Clawdscan 后,可以对 AI 说这些话来触发它
Help me get started with Clawdscan
Explains what Clawdscan does, walks through the setup, and runs a quick demo based on your current project
Use Clawdscan to diagnose Clawdbot/OpenClaw health — session bloat, zombies, stale f...
Invokes Clawdscan with the right parameters and returns the result directly in the conversation
What can I do with Clawdscan in my ai agent & automation workflow?
Lists the top use cases for Clawdscan, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/clawdscan/ 目录(个人级,所有项目可用),或 .claude/skills/clawdscan/(项目级)。重启 AI 客户端后,用 /clawdscan 主动调用,或让 AI 根据上下文自动发现并使用。
Clawdscan 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Clawdscan 可免费安装使用。请查阅仓库了解许可证信息。
Diagnose Clawdbot/OpenClaw health — session bloat, zombies, stale files, AND skill dependency validation. Zero dependencies, single Python file.
Clawdscan 属于「AI Agent & Automation」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my ai agent & automation tasks using Clawdscan
Identifies repetitive steps in your workflow and sets up Clawdscan to handle them automatically