Skip to content
CGclaude-guardian
v1.1.1 — npm package

Your Claude Code flight computer.

Detects hangs, captures evidence, enforces concurrency budgets, and exposes 8 MCP tools so Claude can self-monitor mid-session. Local-only, no network, no telemetry.

Install

npm install -g claude-guardian

Status

claude-guardian status --banner # [guardian] disk=607GB | logs=150MB | risk=ok

MCP

// Claude calls guardian_status mid-session // "Health looks bad. Running guardian_nudge."

How It Works

Signals, incidents, budgets — deterministic reliability with zero heuristics.

Composite hang detection

Three independent signals (log mtime, CPU activity, grace window) vote on whether Claude is stuck. No single false positive can trigger.

Incident state machine

ok → warn → critical lifecycle with automatic bundle capture, deduplication, and timeline reconstruction.

Concurrency budget

Deterministic cap transitions (4 → 2 → 1 slots) with lease-based control. Prevents dogpiling when under pressure.

Evidence, not guesses

Doctor bundles capture process snapshots, log tails, timelines, and journal entries. Attach to issues, not vibes.

8 MCP tools

Claude can check health, fix logs, capture bundles, manage budget, and get step-by-step recovery plans — all mid-session.

Local-only trust model

No network, no telemetry, no cloud. Reads local logs and process metrics. Writes only to ~/.claude-guardian/.

Usage

Install & check health

npm install -g claude-guardian

claude-guardian status
claude-guardian status --banner

Fix log bloat

# Scan and auto-repair oversized logs
claude-guardian preflight --fix

# Aggressive mode when disk is critical
claude-guardian preflight --fix --aggressive

Background daemon

# Continuous monitoring + budget enforcement
claude-guardian watch --verbose

# Check budget
claude-guardian budget show

MCP server for Claude

// Add to ~/.claude.json:
{
  "mcpServers": {
    "guardian": {
      "command": "npx",
      "args": ["claude-guardian", "mcp"]
    }
  }
}

MCP Tools

ToolPurpose
guardian_statusDisk, logs, processes, hang risk, budget, attention level
guardian_preflight_fixRotate/trim oversized logs, returns before/after report
guardian_doctorGenerate diagnostics bundle with full evidence
guardian_nudgeSafe auto-remediation: fix logs, capture bundles
guardian_budget_getCurrent concurrency cap and active leases
guardian_budget_acquireRequest concurrency slots (returns lease ID)
guardian_budget_releaseRelease a lease when done with heavy work
guardian_recovery_planStep-by-step recovery naming exact tools to call

Quality scorecard

Ship Gate audit — 49/50.

CategoryScoreNotes
A. Security10/10SECURITY.md, local-only, no telemetry, no cloud
B. Error Handling10/10GuardianError (code+hint+cause), structured MCP errors, exit codes
C. Operator Docs10/10README, CHANGELOG, HANDBOOK, SHIP_GATE, walkthrough
D. Shipping Hygiene9/10CI + tests (152), npm published, Codecov coverage
E. Identity10/10Logo, translations, landing page, npm listing