Feature request: Hook that fires when approaching usage limits

Resolved 💬 5 comments Opened Feb 18, 2026 by gizmax Closed Apr 24, 2026

Motivation

Hooks currently cover session lifecycle (SessionStart, Stop), user interaction (UserPromptSubmit, PermissionRequest), and notifications — but there's no way to react to usage limits. A hook here would let users:

  • Play an audio alert or send a desktop notification before getting cut off
  • Log usage patterns to understand consumption across sessions
  • Auto-save work or context before hitting the wall
  • Trigger custom automations (e.g. switch to a lighter model, notify team on Slack)

Proposed behavior

  • New hook event: UsageLimitApproaching (or similar)
  • Fires when usage reaches a configurable threshold (e.g. 80% of limit)
  • Hook input receives context:
{
  "hook_event_name": "UsageLimitApproaching",
  "limit_type": "rate_limit",
  "usage_percent": 85,
  "remaining_capacity": 15,
  "reset_at": "2025-02-18T16:00:00Z"
}
  • limit_type: which limit is approaching — rate_limit (per-minute/hour) vs. plan_cap (monthly/daily quota)
  • usage_percent: how close we are to the limit
  • remaining_capacity: remaining units (requests, tokens, etc.)
  • reset_at: when the limit resets (if applicable)

Optional: UsageLimitHit event

A second hook that fires when the limit is actually hit, so users can react immediately (play a sound, send a notification, log the event).

Use case

I built a WC3 Sound Pack for Claude Code hooks — Warcraft III Peasant & Knight sounds as alerts. Session start → "Ready to work", task done → "Job's done", permission → "What?".

For usage limits I want to play a Knight's "Not enough gold" — but there's no hook event to trigger it. Currently Notification is the closest, but it fires for all notifications, not specifically for limits.

Current workaround

None. There is no way to distinguish a usage limit event from other notifications or stop events.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗