Skip to content

Feature: Context overflow warning before hitting limit #13097

@warringk

Description

@warringk

Problem

When a session approaches the model's context limit, the user gets a hard failure:

⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model.

This is abrupt and loses the user's message. There's no way to know you're approaching the limit until you hit it.

Proposed Solution

Add a warning threshold (e.g., 80-90% of context) that:

  1. Warns the user before overflow:

    ⚠️ Context at 85% capacity. Consider using /forget or /new soon.
    
  2. Optionally auto-compact when threshold is reached (configurable)

  3. Show context usage in /status output (tokens used / max)

Benefits

  • Users can proactively manage context before losing messages
  • Better UX than hard failures
  • Helps users understand when to start fresh sessions
  • Could enable smarter auto-compaction strategies

Configuration (suggested)

contextWarning:
  enabled: true
  threshold: 0.85  # warn at 85%
  autoCompact: false  # or true to auto-compact at threshold

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions