[BUG] /context output is appended to conversation history, consuming the context it measures
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet — previous reports were closed without a fix, see below
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Running /context appends its full output to the conversation history, so measuring context usage consumes context. The output is sent to the model twice: once as the ANSI-colored <local-command-stdout> block, and once as a Markdown rendering that includes the per-tool MCP table (one row per deferred MCP tool). /context all adds the expanded tree on top. With ~90 MCP tools connected, a single /context costs about 20k tokens, and every later turn re-sends them.
Previous reports, all closed without a fix and now locked:
- #49335 — closed by the stale bot (
not_planned) - #61907 — closed by its author as a duplicate of #49335
- #71715 — closed by the stale bot (
not_planned)
What Should Happen?
/context (and other purely local diagnostic commands) should display their output to the user without adding it to the conversation sent to the model.
Steps to Reproduce
- Start a fresh session with a few MCP servers connected (~90 MCP tools here).
- Run
/context. Note the Messages figure: 2.6k tokens (total 24.4k). - Exchange one short message.
- Run
/context all. Messages is now 25k tokens (total 46.2k).
The ~22k increase comes almost entirely from the first /context output.
Claude Model
Opus (Opus 5.5)
Is this a regression?
I don't know
Claude Code Version
2.1.284 (Claude Code)
Platform
Anthropic API
Operating System
Debian 13.7
Terminal/Shell
Other (Ghostty)
🤖 Generated with Claude Code