[BUG] Context exhaustion + Write tool overwrote append-only file — full day of design work lost
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?
To: Claude Code team (github.com/anthropics/claude-code/issues)
---
I am a senior engineer using Claude Code (claude-sonnet-4-6) on a company account for a large Java/React platform project. Today I lost an entire day of design work due to two
compounding failures in Claude Code's behavior. This is the third time I have lost multi-hour design sessions to context exhaustion in this project.
Problem 1: Auto-compaction gives no warning and no pause
When the context window fills, Claude Code compresses the conversation automatically and continues working. There is no pause, no prompt asking the user to save state, and no
visible warning before compression fires. By the time auto-compaction triggers, any in-session reasoning that was not written to disk is permanently gone.
I have a Rule-0b-context in my CLAUDE.md that explicitly instructs Claude to write a devlog checkpoint before reaching 90% context. This rule was never triggered — not because
Claude ignored it, but because auto-compaction fires without giving Claude an opportunity to act first. The rule is architecturally impossible to follow.
What I need: a visible warning when approaching ~80–85% context, with a brief pause where Claude writes a checkpoint before compression fires. Even a 30-second interruption would
prevent total design loss.
Problem 2: Write tool used on an append-only file, destroying prior content
During this session, Claude attempted to append to my master devlog file (devlog_2026-10-02.md on OneDrive). The shell append command (cat >>) failed silently because cat is not
on the bash PATH in this environment. Claude then used the Write tool as a fallback — which replaced the entire file with only the new content, permanently deleting all prior
entries including 6 critical design guidelines I had explicitly asked a previous session to document.
Those 6 design points were the governing rules for AbstractAnalyzerModule and OminerResultsTable changes scheduled for today. With them gone, I cannot verify whether any of
today's commits are architecturally correct.
The Write tool description states: "If this is an existing file, you MUST use the Read tool first to read the file's contents." Claude read only the first 15 lines before writing
— not the full file. The remaining content was never read and is now destroyed.
What I need: the Write tool should refuse to overwrite a file unless the full file was read in the same session, or at minimum show a diff of what will be deleted and ask for
confirmation. For devlog/append patterns specifically, an Edit-based append should be the only permitted operation.
Combined impact
I am on a company account and cannot purchase additional tokens. Context exhaustion is not a recoverable event for me — I cannot simply "buy more quota." Each context loss costs
2–4 hours of design reconstruction, which I have now experienced three times in the same project. Today's session ended with a committed file overwrite that may have invalidated
the entire day's code commits.
The devlog + memory file system in my CLAUDE.md exists precisely to prevent this. It cannot work if Claude Code's auto-compaction fires before the devlog is written, and if a
Write tool failure silently destroys the file the devlog was meant to protect
Thank you, and a related issue is that current claude code latest update somehow just make it no longer working in my Windows Server 2016 environment anymore which is annoying for I can only stuck with 2.110 I recall and cannot update the claude code even. This is yet another long hauling in my issue. If we could have a work around on this would be great.
Thank you for your time. Much appreicated.
What Should Happen?
sending an immediately warning if token is nearly out
a workaround version that can be install and run in Windows Server 2016 enviornment or a workaround solution if possible
Error Messages/Logs
Steps to Reproduce
nothing to reproduce. The warning of token out is not consistent, sometime it show up and sometime it does not
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.110
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗