Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Claude Code's usage-limit auto-continue doesn't run in Remote Control sessions. Hooks resume them.

Описание и применение

В Claude Code авто‑продолжение при достижении лимита не запускается в режиме Remote Control. Добавлены хуки, которые автоматически возобновляют сессию после 5‑часового сброса и блокируют работу при 85% недельного лимита.

Задача

Claude Code’s built‑in auto‑continue (autoContinueAtUsageLimit) fails to start in Remote Control sessions, causing sessions to stall at the usage‑limit reset instead of resuming automatically.

Результат

The hooks reliably resume sessions after the 5‑hour reset in Remote Control mode and enforce an 85% weekly usage cap, eliminating manual intervention.

Рабочий процесс

  • 1. Enable autoContinueAtUsageLimit in user settings.
  • 2. Create hooks directory ~/.claude/hooks/usage-guard/ and add usage_guard.py script.
  • 3. Configure hooks in ~/.claude/settings.json for Stop, StopFailure, UserPromptSubmit, and PreToolUse.
  • 4. Ensure asyncRewake:true and appropriate timeouts.
  • 5. Run sessions; hooks will wait for reset, resume session, or block at 85% usage.
  • 6. Monitor usage via added lines in prompts.

Доказательства

Claude Code’s built‑in auto‑continue (autoContinueAtUsageLimit) fails to start in Remote Control sessions

Источник

The docs list the cases where the built‑in wait doesn't start: Remote Control and agent team teammate sessions

Источник

The fix is a pair of hooks, Stop and StopFailure, with asyncRewake. They wait for the 5‑hour reset and wake the session with exit 2, unless the built‑in already resumed it.

Источник

Checked with two real probe sessions and 35 unit tests. Not tested live: a real 5‑hour reset, the 85% paths and a real rate_limit StopFailure payload.

Источник

  • Дата записи: 2026-10-04T09:40:59.299Z