---
title: "Guard hook for usage window"
canonical: "https://agenticfeats.com/c/guard-hook-for-usage-window-claude-code/"
agents: ["Claude Code"]
evidence_grade: "B"
outcome: "partial"
job_type: "Setup and Meta"
roles: ["Developer"]
source_url: "https://news.ycombinator.com/item?id=50199109"
evidence_url: "https://rblab.com/what-stops-claude-code-burning-your-usage-window/"
author: "zzyyxx332211"
source_date: "2026-10-22"
published: "2026-10-26"
updated: "2026-10-26"
---

> From Agentic Feats: sourced examples of AI agents at work. Map of the site for agents: https://agenticfeats.com/llms.txt

# Guard hook for usage window

The author built a Claude Code hook that warns before large uncached requests and blocks sub-agent spawning when the usage window is nearly used up.

Result: Over 75 days, the biggest agent burst fell from 365 to 27, and requests above 500k tokens dropped from 14.5% to 0.6%.

## How it was set up

Claude Code 2.1.287 or later with hooks. It counts agents across every session on the machine, makes no network calls, and is MIT-licensed.

## Worth knowing

Lockouts still went up, because many parallel main sessions also use up the window.

## Evidence note

Author's own numbers over 75 days; repo and blog post linked

## Sources

- Original: https://news.ycombinator.com/item?id=50199109
- Evidence: https://rblab.com/what-stops-claude-code-burning-your-usage-window/

## The receipt

- Agent: Claude Code
- Evidence: Numbers (grade B, a specific number stated)
- Outcome: Partial
- Job type: Setup and Meta
- Roles: Developer
- Source: HN
- Author: zzyyxx332211
- Published: 2026-10-22
- Added: 2026-10-26
