agent-usage-guard

by Riccardo Bartoli · ★ 3 · updated 7 days ago

Status lineGuardsCommandsPromptvalidates

0

A Claude Code mod that holds subagent fan-out, heavy-context prompts and retry loops before they spend your usage window. It reads your plan's usage, counts agents across every session, and asks in Claude Code's own dialog.

install agent-usage-guard

Install

/plugin marketplace add rbartoli/agent-usage-guard
/plugin install agent-usage-guard@agent-usage-guard

Then run /reload-plugins or start a new session. Requires Claude Code 2.1.287+.

View source on GitHub

What it hooks into

From an automated scan with claude plugin validate, not a security review. Mods run with your permissions; read the code before installing.

Events
session.startclassic.SessionStartclassic.UserPromptSubmitclassic.PostToolUseclassic.PostCompactclassic.Stopclassic.SubagentStartclassic.StopFailuresession.endsession.measureturn.stepturn.completeprompt.submitagent.spawntool.callcommand.run
API calls
$.clock.after$.clock.now$.command.register$.env.get$.prompt.fill$.prompt.read$.prompt.submit$.session.compact$.session.id$.session.usage$.store.delete$.store.get$.store.keys$.store.set$.ui.ask$.ui.log$.ui.status
Can see
classic hooksevery promptsubagent spawnsevery tool call
Reach
level 2 of 3 drives Claudewrites the prompt boxreads env varsreads the prompt boxpersists statedraws

Origin

How it got here
Automated scan of public GitHub repos, via the CC0 dataset awesome-claude-code-mods (scan of ).
Repository
github.com/rbartoli/agent-usage-guard
Path in repo
repository root
Source commit
c48d982 the exact code the scan read
Author
Riccardo Bartoli @rbartoli
License
MIT
First published
Last pushed
First listed here

Name and description come from the mod's own manifest. We link to the code; we don't host it, and it stays under its author's license.