[BUG] /context command output appends to conversation history, causing immediate context inflation (~5k+ tokens)

Resolved 💬 5 comments Opened May 23, 2026 by LostBeard Closed May 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When checking system stats using the /context command, the CLI agent appends the detailed diagnostic text output (including listed MCP tools, memory file paths, and built-in skills) directly into the message history thread. Because LLM execution is stateless, subsequent turns must send this entire generated output block back to the API model. This results in an immediate, compounding token tax just for inspecting state.

What Should Happen?

Suggested resolution:
Telemetry commands like /context or /mcp should ideally write their UI/diagnostic output directly to the local terminal buffer without appending that generated output text to the active conversation history payload (Messages), preserving the user's available context window for actual development.

Error Messages/Logs

Steps to Reproduce

Steps to reproduce:

  1. Run /context in an active session. Note the token count under Messages.
  2. Immediately run /context a second time without any other commands or code modifications.
  3. Observe that Messages usage jumps significantly (in this example, an immediate increase of 5.1k tokens), and available Free space drops accordingly.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.148

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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