claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Add context usage warning before auto-compact

Open SDS-Mike opened this issue 1 year ago • 6 comments

Feature Request: Context Usage Warning Before Auto-Compact

Problem: Users aren't warned before auto-compact happens, losing conversation context unexpectedly during long coding sessions.

Proposed Solution: Add a configurable warning when context usage reaches a specified threshold (e.g., 90%).

Use Case:

  • Long debugging sessions where conversation history is critical
  • Complex multi-step implementations where losing context breaks flow
  • Users who want to proactively use /memory before auto-compact

Suggested Implementation:

  • Setting: CLAUDE_CODE_CONTEXT_WARNING_THRESHOLD=0.9 (default 90%)
  • Display: "⚠️ Context 90% full - consider using /memory to save important info"
  • Optional: Show current context usage percentage in status

Benefits:

  • Prevents unexpected context loss
  • Encourages proactive memory usage
  • Improves user experience for power users

Alternative: Could also be implemented as a status indicator showing current context usage percentage.

SDS-Mike avatar Aug 13 '25 23:08 SDS-Mike

@SDS-Mike I always get an indicator saying "xx% left before compact" in my terminal - you don't get this? i tend to run with --verbose and/or --debug but I thought this was a feature already.

hesreallyhim avatar Aug 14 '25 00:08 hesreallyhim

The problem is I don’t always notice it. I’m hoping for Claude to alert me in its output I’m a more prominent way.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Really Him @.> Sent: Wednesday, August 13, 2025 5:21:28 PM To: anthropics/claude-code @.> Cc: Mike Morris @.>; Mention @.> Subject: Re: [anthropics/claude-code] Add context usage warning before auto-compact (Issue #5720)

Shadow IT Email Protection Warning: The sender @@.***​.com might be a spam sender. Block as Spamhttps://cloud.graph.us/feedback?msgId=PGFudGhyb3BpY3MvY2xhdWRlLWNvZGUvaXNzdWVzLzU3MjAvMzE4NjI1NjY3NEBnaXRodWIuY29tPg%3D%3D&orgDomain=c2VxdWVsZGF0YS5jb20%3D&sndr=cnF1dlBLdHBvQXNMay9udFdnV2dJUXhWazVaanZZVG12QTVvMzFETmRoczNNWEtRaG55cXdBPT0%3D&rcpnt=ME5ZdGhUT2VPTGxBbW1VaDdlQi85Vk5zK25QcTVxTHV0aHhaMXY3MXZLU0NzVThtTm51TWNRPT0%3D&opt=spam Not a Spam Senderhttps://cloud.graph.us/feedback?msgId=PGFudGhyb3BpY3MvY2xhdWRlLWNvZGUvaXNzdWVzLzU3MjAvMzE4NjI1NjY3NEBnaXRodWIuY29tPg%3D%3D&orgDomain=c2VxdWVsZGF0YS5jb20%3D&sndr=cnF1dlBLdHBvQXNMay9udFdnV2dJUXhWazVaanZZVG12QTVvMzFETmRoczNNWEtRaG55cXdBPT0%3D&rcpnt=ME5ZdGhUT2VPTGxBbW1VaDdlQi85Vk5zK25QcTVxTHV0aHhaMXY3MXZLU0NzVThtTm51TWNRPT0%3D&opt=notaspam powered by Graphus® [https://avatars.githubusercontent.com/u/172150522?s=20&v=4]hesreallyhim left a comment (anthropics/claude-code#5720)https://github.com/anthropics/claude-code/issues/5720#issuecomment-3186256674

@SDS-Mikehttps://github.com/SDS-Mike I always get an indicator saying "xx% left before compact" in my terminal - you don't get this? i tend to run with --verbose and/or --debug but I thought this was a feature already.

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/5720#issuecomment-3186256674, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMNMR2KBS4OWSBRXWN67CRD3NPJARAVCNFSM6AAAAACD3DRRLOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCOBWGI2TMNRXGQ. You are receiving this because you were mentioned.Message ID: @.***>

SDS-Mike avatar Aug 14 '25 00:08 SDS-Mike

Related: https://github.com/anthropics/claude-code/issues/3584

sobri909 avatar Aug 14 '25 02:08 sobri909

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/3584
  2. https://github.com/anthropics/claude-code/issues/5746
  3. https://github.com/anthropics/claude-code/issues/4213

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 15 '25 21:08 github-actions[bot]

This issue has been automatically closed as a duplicate of #3584.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 19 '25 09:08 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 26 '25 14:08 github-actions[bot]