[FEATURE] Warn user before context window limit is reached (not after)

Resolved 💬 2 comments Opened Jun 4, 2026 by tejashgowds-eng Closed Jun 7, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem

Claude Code hits the context limit and throws an error mid-session with no prior warning.
By the time the error appears, the conversation context is already lost and cannot be recovered.

Proposed Solution

Expected behavior

Warn the user when ~70-80% of the context window is used, so they can:

  • Run /compact to free up space, OR
  • Ask Claude to summarize context and start a fresh window without losing work

Current behavior

Error only appears after the limit is fully exhausted:
"API Error: Usage credits required for 1M context"
No warning. No recovery. Full context lost.

Suggested solution

Show an inline warning in the chat (e.g. "You've used 75% of the context window.
Consider running /compact or starting a new session.") before the limit is hit.

Impact

Mid-session work is lost with no way to recover the conversation history.

Alternative Solutions

_No response_

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

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