Expose context window utilization to the agent

Resolved 💬 3 comments Opened Mar 24, 2026 by nedlern Closed Apr 23, 2026

Problem

Claude Code cannot check its own token usage or context window utilization. The agent flies blind regarding its memory limits and can only detect degradation after it starts forgetting context, repeating mistakes, or being corrected more often.

Proposed solution

Provide a built-in tool or environment variable (e.g., getTokenUsage()) that returns current context utilization. The agent could then autonomously trigger a state-save or prompt the user for a restart before quality degrades.

Why it matters

Users currently have to notice degradation themselves and manually start a fresh session. The agent should be able to self-monitor and proactively suggest saving state, rather than silently getting worse.

🤖 Generated with Claude Code

View original on GitHub ↗

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