Commands
Command overview
Section titled “Command overview”| Command | Purpose |
|---|---|
preflight | Scan Claude project logs, report oversized dirs/files, optionally auto-fix |
doctor | Generate a diagnostics bundle (zip) with system info, log tails, journal |
run -- <cmd> | Launch any command with watchdog monitoring, auto-bundle on crash/hang |
status | One-shot health check: disk free, log sizes, warnings |
watch | Background daemon: continuous monitoring, incident tracking, budget enforcement |
budget | View and manage the concurrency budget (show/acquire/release) |
mcp | Start MCP server (8 tools) for Claude Code self-monitoring |
preflight
Section titled “preflight”Scans ~/.claude/projects/ for oversized log directories and files.
# Report onlyclaude-guardian preflight
# Auto-fix: rotate + trim oversized logsclaude-guardian preflight --fix
# Aggressive mode: shorter retention, lower thresholdsclaude-guardian preflight --fix --aggressiveRotation compresses old logs with gzip (reversible). Trimming keeps the last N lines of oversized files. No files are deleted.
doctor
Section titled “doctor”Creates a zip bundle containing:
summary.json— system info, file size report, preflight resultslog-tails/— last 500 lines of each log filejournal.jsonl— every action the guardian has ever taken
claude-guardian doctorclaude-guardian doctor --out ./my-bundle.zipSpawns a child process with watchdog monitoring.
claude-guardian run -- claudeclaude-guardian run --hang-timeout 120 -- node server.jsclaude-guardian run --auto-restart -- npm startThe watchdog uses three independent signals (log mtime, CPU activity, grace window) to detect hangs. No single false positive can trigger a hang declaration.
status
Section titled “status”Quick one-shot health check.
claude-guardian statusclaude-guardian status --bannerReports disk free space, log sizes, and a summary banner.
Background daemon for continuous monitoring.
claude-guardian watchclaude-guardian watch --verboseTracks incidents through an ok → warn → critical lifecycle with automatic bundle capture and deduplication.
budget
Section titled “budget”Manage the concurrency budget.
claude-guardian budget showclaude-guardian budget acquire --slots 2 --reason "build"claude-guardian budget release --lease <id>Deterministic cap transitions (4 → 2 → 1 slots) prevent dogpiling when under pressure.