Show HN: agent-usage-guard – a Claude Code mod to protect your usage window
Posted by zzyyxx332211 5 days ago
Comments
Comment by zzyyxx332211 5 days ago
The first I built, based on hooks (run for 75 days), the biggest burst fell from 365 agent spawned to 27, and requests over 500k tokens of context from 14.5% to 0.6%. Lockouts still went up, because lots of parallel main sessions use up the window too. The strength is that it counts agents across every session on the machine.
I built https://github.com/rbartoli/agent-usage-guard, MIT-licensed, makes no network calls, needs Claude Code 2.1.287 or later.
I have also a post on this: https://rblab.com/what-stops-claude-code-burning-your-usage-...
Comment by donfuzius 5 days ago
Comment by zzyyxx332211 5 days ago
The ones that depend on the plan are the absolute numbers: 4 agents running at once, 12 agent starts per 10 minutes, 10M subagent tokens per 10 minutes, and the 500k context before it asks to compact. I tuned them on my own Max 5x, so on Pro they are probably too loose. You can change all of them with env vars (AGENT_GUARD_*), but presets per plan is a good idea, I'll look into it.
Comment by khalidsaidi 3 days ago
Comment by adastra22 4 days ago
Comment by Robin_Message 5 days ago
Comment by randomblock1 5 days ago
Comment by SOLAR_FIELDS 5 days ago
Comment by neuronexmachina 5 days ago
Comment by bhu8 5 days ago
Comment by zzyyxx332211 5 days ago
So it only pays off if the session goes on. In my own dogfooding tests, I compacted 47 times out of 50 it had suggested.
Comment by plaguuuuuu 3 days ago
Comment by agoopintsai 18 hours ago
Comment by sy135673 4 days ago
Comment by yangxm 4 days ago
Comment by RohaanXD 5 days ago
Comment by byhagood 5 days ago
Comment by garamnoh 4 days ago
Comment by aidiveyt 4 days ago
Comment by AlekVectis 5 days ago
Comment by Morkeeth 3 days ago
Comment by pang_claw 4 days ago