claude-code - 💡(How to fix) Fix Feature Request: Auto-pause when approaching usage limit to prevent work loss [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47157Fetched 2026-04-13 05:39:56
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Fix Action

Fix / Workaround

Current Workaround

Code Example

{
  "usage": {
    "autoPauseThreshold": 90,
    "onThresholdReached": "pause"
  }
}
RAW_BUFFERClick to expand / collapse

Problem

When running long autonomous workflows (e.g., batch processing with multiple sub-agents), hitting the usage limit mid-task causes work loss:

  • Sub-agents may fail mid-write, leaving files in inconsistent state
  • Main agent loses context and can't complete validation/commit cycle
  • User has to manually recover and figure out what was completed vs. what failed

Currently there's no way to know how close you are to the limit until you hit it.

Proposed Solution

Add an auto-pause threshold setting that stops launching new work when usage approaches the limit:

{
  "usage": {
    "autoPauseThreshold": 90,
    "onThresholdReached": "pause"
  }
}

Behavior:

  1. Before each tool call (especially Agent launches), check current usage percentage
  2. If usage ≥ threshold (e.g., 90%), finish current in-flight work but don't start new batches
  3. Notify user: "Usage at 92% — pausing to prevent work loss. Resume after limit resets."
  4. Allow user to override: "continue anyway"

Why this matters for sub-agent workflows:

  • Multiple parallel sub-agents consume tokens rapidly
  • If limit hits mid-batch, some agents fail while others succeed → inconsistent state
  • With auto-pause, the last batch completes cleanly and stops gracefully

Current Workaround

User manually estimates batch count and says "do N batches then stop" — but this is imprecise since there's no visibility into remaining usage.

Nice-to-haves

  • claude usage CLI command to check current usage/remaining percentage
  • Usage percentage visible in VS Code status bar
  • Webhook/notification when threshold reached

Environment

  • Claude Code VS Code Extension + CLI
  • Windows 11 / macOS
  • Max plan (weekly usage limit)

extent analysis

TL;DR

Implementing an auto-pause threshold setting can help prevent work loss by stopping new work when usage approaches the limit.

Guidance

  • To mitigate work loss, consider implementing a feature to check current usage percentage before launching new work, such as sub-agents, and pause when the threshold is reached.
  • Introduce a configuration option, like autoPauseThreshold, to allow users to set the threshold at which new work is paused.
  • Notify users when the threshold is reached, providing an option to override and continue work if necessary.
  • Consider adding a CLI command, such as claude usage, to provide visibility into current usage and remaining percentage.

Example

{
  "usage": {
    "autoPauseThreshold": 90,
    "onThresholdReached": "pause"
  }
}

This example configuration sets the auto-pause threshold to 90%, which means new work will be paused when usage reaches 90% of the limit.

Notes

The proposed solution focuses on preventing work loss by pausing new work when the usage limit is approached. However, implementing this feature may require significant changes to the existing workflow management system.

Recommendation

Apply workaround: Implementing an auto-pause threshold setting can help prevent work loss, and providing users with visibility into current usage can help them manage their workflows more effectively.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING