[BUG] total_tokens system message is appended to context after EVERY request

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

Claude code appends block with system message "total_tokens" to context window:

<system-reminder>
<total_tokens>14999841 tokens left</total_tokens>
</system-reminder>

It looks innocent enough, and only 23 tokens, no big deal by itsefl

Till you figure out, that its being added on every request, and 15mins later its taking up significant part of context window (60 x 23 = 1218 tokens in every request, and growing with each request)

What Should Happen?

I would assume if intention is to inform how many tokens are left, only one message should be enough

Error Messages/Logs

Steps to Reproduce

Use claude code for daily tasks, inspect the request being sent to api for occurences of
<total_tokens/> block

Claude Model

_No response_

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.248

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗