[BUG] Hundreds of lines of modified file notes being injected into context on EVERY user message via <system-reminder>
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?
Update: I've just encountered this issue with files that were edited only by the agent, I hadn't touched them during the session. This means there's no reliable way to avoid the issue.
Update 2: As of at least version 2.1.70 this bug is now injecting the full contents of the edited file(s) into context each turn. It takes only one largeish file being edited to completely eat the context window in a handful of turns. The bug still happens on both agent and user edits.
I'm using Claude Code for VS Code on Windows. I also have the CLI version but I have not tested this issue there, from the behavior I'd guess it's extension specific.
For at least the last two weeks context has intermittently been getting used up suspiciously fast. I've just been writing it off as some sort of transient issue that would get fixed eventually. In addition the model has been strangely dumber than I'm used to, but not consistently. Weird but not easily reproducible. Definitely frustrating and harder to work with. Causes usage limits to be eaten up more quickly.
Then today the agent said something that made it all make sense. They mentioned some context I wasn't aware of and upon investigation, I discovered this:
In a session where I'd had the agent make some code modifications, and I then made my own changes to the same files, the changes were being injected into context after EVERY subsequent message I was sending, in this format:
<system-reminder>
Note: [Full path and filename] was modified, either by the user or by a linter. This change was intentional, so make sure to take it into account as you proceed (ie. don't revert it unless the user asks you to). Don't tell the user this, since they are already aware. Here are the relevant changes (shown with line numbers):
[All lines edited in the file here]
</system-reminder>
Key points:
- The reminders are added to every message the user sends following the edits
- The reminders are 100's of lines of code and could easily be 1000's of lines because:
- If the edits are in multiple places in the file, the reminders include all code between the first edit and the last. Thus if a small edit was made at the top of the file, and another at the bottom, the reminder injection includes the ENTIRE file
- Reverting the user changes causes the message injection to stop
- The reminders happen regardless of whether or not the file is open in the IDE, making it impossible to stop the behavior without reverting the changes or starting a new session
- Unsurprisingly, the reminders cause subsequent simple back and forth chat to eat through the entire context window in a short time
This explains both the strange context usage in recent weeks and the agent drift.
I also discovered other context injections like:<system-reminder>
The TodoWrite tool hasn't been used recently. If you're working on tasks that would benefit from tracking progress, consider using the TodoWrite tool to track progress. Also consider cleaning up the todo list if has become stale and no longer matches what you are working on. Only use it if it's relevant to the current work. This is just a gentle reminder - ignore if not applicable. Make sure that you NEVER mention this reminder to the user
</system-reminder>
Which is less egregious since injections like that only happen once, as opposed to every message. But after the former discovery I have no trust that these sorts of hacky injections won't eventually add up to dealbreaking context issues.
It's hard not to be frustrated by this as it's such as obvious bug, it should never have made it into production, and because the agent is instructed to hide it from the user, it took all this time to even notice it was happening. I had just adjusted my workflow to start a new session whenever context started getting eaten up unexplainably or the agent started going off the rails. I had to do this often enough that I was starting to wonder if I should switch to a different provider. Despite Codex being a somewhat less proficient assistant, at least I don't have to restart the session multiple times during simple tasks.
To other CC VS Code extension users: please confirm this behavior and post your results here so that it gets fixed quickly and we can go back to having a usable tool.
What Should Happen?
The harness shouldn't be injecting messages about edits along with every user message. I could see this behavior being useful as a _one time_ injection after a user makes an edit, but it makes no sense to attach it to every subsequent message. In the case of a one time injection, at most it should include diffs (as opposed to, potentially, entire files) and really in order to accomplish the apparent goal of stopping the agent from interfering with user changes, or making it aware of them, it would really only need to include something like "user has edited [file], [Line Numbers]"
Error Messages/Logs
Steps to Reproduce
- Use Claude Code for VS Code extension
- Have the agent read/modify some files
- Make manual changes to the same files in multiple locations
- Observe context injections on all subsequent user messages unless/until the user changes have been reverted
Note: I was able to get the agent to let me know about the <system-reminder> injections despite its instructions to hide them. Please Anthropic, don't go the way of other tools/providers and start instructing agents not to tell users more and more things. A big part of your demographic is developers, we need to understand the environment our tools are operating in. It was really just luck that I noticed this issue.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.75
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
27 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
These issues appear related to repeated system-level context being re-injected on every user turn without a clear lifecycle.
Even when the content is correct, unbounded repetition (especially hidden from the user) leads to cost amplification, behavior drift, and loss of observability.
This looks less like isolated bugs and more like a state-scoping / lifecycle problem (text injection vs bounded, explicit state).
These issues appear related to repeated system-level context being re-injected on every user turn without a clear lifecycle.
Even when the content is correct, unbounded repetition (especially hidden from the user) leads to cost amplification, behavior drift, and loss of observability.
This looks less like isolated bugs and more like a state-scoping / lifecycle problem (text injection vs bounded, explicit state).
After more testing: This behavior is not present in CC CLI. There the agent gets a one time <system-reminder> message on user edits and no messages on files the agent edits.
Currently (still) in CC for vs code extension the agent gets reminders for user edits and (most of the time) for edits made by the agent itself. These messages then persist with every user message for the rest of the session.
This has been going on for weeks now, possibly longer. Ya'll have got to be bleeding users from the extension as this issue is fairly transparent. From a user perspective, all they know is that context is used up so quickly in any session with file edits that the tool feels unusable.
Many have previously lamented the 2nd class citizenship of the extension, but this is another level of broken.
I just logged in to report this same bug. I asked Claude why we're using context so fast and it identifies the system reminder as the culprit, to the tune of several thousand tokens per turn even if the file untracked by git, unchanged for hours, etc. Claude insisted I filed it and provided me a link and the full write up.
Thanks @designbyian for suggesting the CC CLI client. I also tested this, using one of the chats that has the
<system-reminder>. The FIRST user message does repeat the reminder to the model. After that, it appears to be cleared and stops sending. So, thankfully, I haven't lost my chat.Guess I'm sticking with the CLI client for now. Too bad!
Edit: Just to confirm, if I go back to the VS Code extension and continue the prior chat, the system message returns. It doesn't get cleared. But if I start a new chat, in VS Code, it won't have the same system reminder message automatically.
Something I forgot to mention in my original report: this issue happens with no linter running.
This issue is still happening in CC for VS Code extension version 2.1.5
Still happening in version 2.1.7
At this point it’s hard to say this wasn’t known — the behavior has been observed, patched, and re-emerged.
Still in version 2.1.9
Still in version 2.1.11
Still in version 2.1.15
I'm confused, I understand that there are a lot of issues reported, but this issue has been open for weeks, the bug has been happening for longer than that, it's easy to reproduce and breaks the functionality of the extension. It seems like the sort of thing that would be a priority, or at least warrant some kind of response or status update.
Still in version 2.1.17
Update: I don't know if this is new behavior but I discovered that having Claude Code read a file again causes the <system-reminder> messages to stop for that file. Which changes the issue from "system messages persist for the rest of the session" to "system messages persist until the file is re-read by the agent".
Still in version 2.1.20
Still in version 2.1.25
Still in 2.1.29
Still in 2.1.33
Still in 2.1.39
Still in 2.1.44
Still in 2.1.49, as well as version 2.1.50 of the Claude Code CLI (in headless mode only)
Still happening in version 2.1.63 of both extension and CLI in headless mode
Still happening in 2.1.70 and the bug has gotten dramatically worse somewhere along the way. In a recent test the FULL contents of the edited file are being injected on every turn. In that cause with a ~1300 line file it was using 15%+ of the context window on each turn and the full context was used up in about 5 turns. The VSCode extension is now essentially impossible to use, at least on Windows.
I'm able to reproduce this in 2.1.71 in claude-code CLI in headless mode, as well as in standard mode using
--resumefor a session started in headless mode. Specifically any files that were written to with the Edit tool that have not been subsequently loaded with the Read tool are always counted as "stale", causing a state re-injection.I am no longer able to reproduce this issue in version 2.1.76. Since I couldn't find a mention of it in the change log in any recent version updates I'm concerned the fix is incidental and there will be another regression. Communication from the team would be amazing!
In the meantime I'll check in the next few versions.
Having done a bit more research into this, I believe this is related to the
file snapshots not being created when run in headless mode.
On Sun, 15 Mar 2026, 10:11 designbyian, @.***> wrote:
Hasn't regressed as of 2.1.85, closing
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.