[BUG] /context output pollutes session context after it runs

Status Open
Reported on v2.1.263
Maintainer reply None cached
Activity 0 comments · opened Sep 7, 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?

The output of /context is written into the conversation transcript as local command output and re-sent to the model on every subsequent request for the rest of the session. /context is a purely informational snapshot meant for the user in the terminal; its table carries no value for the ongoing conversation, yet once run it permanently consumes context tokens.

The behavior is also self-defeating: running the command that reports context usage itself inflates the "Messages" bucket it just reported on. Measured by running /context twice back-to-back with nothing else in between — "Messages" went from 19.1k to 19.8k tokens, i.e. ~0.7k tokens added per /context invocation. Every run compounds it, and there is no way to remove the entries short of /clear or auto-compact.

I tested a few other informational commands. /status output does not appear to reach the model (the assistant could not reference it afterward), so this may be specific to /context or a subset of commands. This report is scoped narrowly to /context.

What Should Happen?

/context output must never enter the model transcript. It is a UI diagnostic for the human — the model has no use for it, and injecting it is pure noise in the context window. Irrelevant filler in context measurably degrades a coding agent's output quality (attention gets spread over tokens that don't matter, and the agent may treat the stale snapshot as a live fact). "Drop it first on auto-compact" is not sufficient — it should not be written to the transcript in the first place. Render it in the terminal, keep it out of context entirely.

Error Messages/Logs

Two consecutive /context runs, nothing else between them:
  1st run reports:  Messages = 19.1k tokens
  2nd run reports:  Messages = 19.8k tokens
  => ~0.7k tokens per /context invocation, persisted for the rest of the session

Steps to Reproduce

  1. Start a session and run /clear.
  2. Run /context; note the reported "Messages" token count.
  3. Run /context again — "Messages" has grown by ~0.7k, because the first run's table is now in the transcript.
  4. Direct confirmation that it reached the model: after running /context, ask the agent to quote or summarize its last /context output. It can, which is only possible if the text was injected into context.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.263

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Confirmed only for /context; /status does not appear affected. A general fix would be to tag informational slash-command output as transient so the transcript builder omits it when assembling model context, while still displaying it in the terminal.

View original on GitHub ↗