[FEATURE] Show token usage preview before sending message and detailed error when context exhausted

Resolved 💬 3 comments Opened Jan 17, 2026 by mehulparmariitr Closed Jan 21, 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

When pasting large content into Claude Code, there's no way to know how many tokens it will consume before hitting Enter. If the message exceeds remaining context, the request fails without helpful information.

Current behavior:

  • Status line shows remaining tokens/percentage AFTER messages are processed
  • No preview of incoming message size
  • When context is exhausted, no breakdown of "you had X tokens, but needed Y"

Expected behavior:

  1. Show estimated token count for the staged message before sending (e.g., in status line: Context: 45% remaining | Pending: ~8k tokens)
  2. When context overflow occurs, display: Context exhausted: had 12,000 tokens remaining but message requires ~25,000 tokens

Proposed Solution

Use Case

When debugging, I often paste large log files or stack traces. Without knowing how much space they'll consume, I either:

  • Hit context limits unexpectedly
  • Waste time splitting content that would have fit
  • Have to restart conversations unnecessarily

Suggested Implementation

  • Tokenize pending input in real-time (or on paste) and display estimate
  • On context overflow error, include both remaining and required token counts

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

Use Case

When debugging, I often paste large log files or stack traces. Without knowing how much space they'll consume, I either:

  • Hit context limits unexpectedly
  • Waste time splitting content that would have fit
  • Have to restart conversations unnecessarily

Additional Context

_No response_

View original on GitHub ↗

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