agent-usage-guard

by Riccardo Bartoli · ★ 103 · updated 14 days ago

BandsStatus lineGuardsCommandsPromptwarnings

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.SubagentStartclassic.StopFailuresession.endsession.measureturn.stepturn.completeprompt.submitagent.spawntool.callui.rendercommand.run
API calls
$.clock.after$.clock.now$.command.register$.env.get$.fs.read$.prompt.fill$.prompt.read$.prompt.submit$.session.compact$.session.id$.session.messages$.session.usage$.state.get$.state.set$.store.delete$.store.get$.store.keys$.store.set$.ui.ask$.ui.log$.ui.resolve$.ui.status
Draws
AbovePrompt
Can see
classic hooksevery promptsubagent spawnsevery tool call
Reach
level 2 of 3 drives Claudewrites the prompt boxreads filesreads env varsreads the transcriptreads the prompt boxreads mod statepersists 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
02594c2 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.

Other mods in Bands, close to this one by stars.