Claude Code hook
Agent Usage Guard
Hook mod that pauses subagent fan-out, heavy prompts and retry loops before they burn quota.
Install
/plugin marketplace add rbartoli/agent-usage-guardgit clone https://github.com/rbartoli/agent-usage-guard.gitFrom the README
agent-usage-guard Stops Claude Code from spending your five-hour usage window in ten minutes. agent-usage-guard is a Claude Code mod: it runs inside Claude Code and holds runaway spend before it happens. It reads your plan's live usage, and it holds subagent fan-out, heavy-context churn and retry loops. Recorded from Claude Code's interactive UI with the guard loaded. A scripted local API stands in for Claude, so the sessions and token counts are staged and no usage is spent. Every question on screen is the guard's own. Rebuild it from the Northstar fixture. It acts before the spend, not after it: before an agent starts, a prompt is sent, or a tool call runs. Agent limits hold across every Claude Code session on your machine, and fan-out and heavy context are capped at any usage level, not only near the limit. When you are at the keyboard it asks you, in Claude Code's own question dialog. When nobody can answer, it refuses and tells Claude why, so the model can wait, batch the work, or stop. /agent-guard report shows what it did. - Plan-aware. It reads the 5-hour and weekly percentages Claude Code reports, and keeps the end of the window for you. - One answer covers a while. An approval lifts its condition until it clears or times out, so the same question does not come back call after call. - Local and privacy-minimal. No network, no processes. It stores counts and coarse buckets, never prompt text, tool inputs or model output. - Fails open. If one of its hooks fails, the event goes ahead: a broken guard never breaks your session. The one exception is an agent it could not judge, which is refused so that Claude starts it again. Install Run these commands inside Claude Code v2.1.287 or later: Then run /agent-guard to see what it sees. Mods are on by default;…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- rbartoli/agent-usage-guard
- Type
- Hooks
- Language
- TypeScript
- License
- MIT
- Last updated
- 1 November 2026
- Topics
- ai-agentsclaude-codeclaude-code-modclaude-code-plugindeveloper-toolsguardrailsrate-limitingsubagentstypescriptusage-limits
FAQ
What is Agent Usage Guard?
Hook mod that pauses subagent fan-out, heavy prompts and retry loops before they burn quota. It is a hook for Claude Code, from rbartoli/agent-usage-guard on GitHub.
How do I install Agent Usage Guard?
Run /plugin marketplace add rbartoli/agent-usage-guard inside Claude Code, then follow the setup in the README.
Is Agent Usage Guard popular?
rbartoli/agent-usage-guard has 93 GitHub stars and 5 forks. It was last updated on 1 November 2026.
More hooks
Claude Memory Engine
134HelloRuru/claude-memory-engine
Claude Code 的記憶系統 | A memory system built with hooks + markdown. Zero dependencies.
Canny
132qkal/Canny
Stops AI coding agents from claiming work is done without evidence. Deterministic hooks decide, TypeSafe's Jev advises. Append-only ledger, zero runtime dependencies.
Claude Adhd Skills
171ravila4/claude-adhd-skills
Claude Code skills and hooks for staying organized with AI agents.
Helpline
115coleam00/helpline
Demonstration codebase for building the AI Layer (CLAUDE.md hierarchy, hooks, skills, LSP, MCP, plugin) — companion repo for the 'How Claude Code works in large codebases' video.
agentjail
100LuD1161/agentjail
Policy guardrails that check every Claude Code, Codex or Cursor tool call against local rules.
Claude Code Patterns
126AaronRoeF/claude-code-patterns
Field-tested Claude Code patterns & anti-patterns for personal agents — an AI workflow that compounds: knowledge base, memory consolidation, hooks, subagents. Enterprise agent trust: agentrust-io.com. Updated monthly.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.