← Back to plugins

cost-guard

Command by oggeh-dev · 1 stars

Real-time USD cost enforcement for Claude Code. Halts runaway agentic loops mid-step before they burn through your budget. The plugin enforces real-time USD cost limits in Claude Code. It uses hooks to read the session's the moment any cap is crossed — between tool batches, between turns, or at prompt-submit time. The result: a single greedy turn cannot spiral into a $30+ spend, sessions cannot silently accumulate cost over hours, and runaway burn rates are stopped before they hurt. Five configurable USD-based caps: • Per-session total spend • Per-step (prompt → response) cost • Trailing 5-minute burn rate • Per-step subagent fan-out count • Compaction gate (blocks the expensive context-compaction model call when limits are tight) Eleven slash commands for status, runtime config, pause/resume, and an optional bottom-row indicator. The indicator shows session spend, rate, current step cost, context %, and (on Claude.ai Pro/Max) 5-hour slot consumption with an estimated USD plan value. It composes with any existing statusLine (preserving your starship setup, etc.) or takes over the slot — your choice at install time. Pure Python 3 standard library. No runtime dependencies. No network calls. All enforcement is local; the plugin only reads the JSONL transcript Claude Code already writes. Screenshot: https://github.com/oggeh-dev/claude-cost-guard/blob/main/docs/indicator.png

/plugin install cost-guard@claude-community