[BUG] Accepting plan with 'clear context' discards file-read records — forces redundant re-reads during implementation
Preflight Checklist
- [x] I have searched existing issues and this has not 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?
When accepting a plan via ExitPlanMode and choosing "Yes, clear context", all file-read records from the planning phase are discarded. The Edit tool has a guardrail requiring that a file must be read before it can be edited, so Claude is forced to re-read every file it already read during planning before making any changes.
This creates a wasteful cycle:
- Plan mode: Claude reads 10-20 files to understand the codebase and writes a detailed plan
- Accept plan: User accepts and selects "clear context" to free up the context window
- Implementation begins: Claude must re-read all the same files because the Edit tool no longer knows they were already read
The re-reads are pure overhead — Claude already understood the files well enough to write a plan referencing them, but the tooling forces it to read them again from scratch.
What Should Happen?
When context is cleared upon plan acceptance, the system should preserve a lightweight index of files that were read during planning (file path + last-read timestamp or content hash). This way the Edit tool's read-before-edit guardrail is satisfied without requiring full re-reads.
Alternatively, the plan file could include a manifest of files read during planning, and the system could treat those as "pre-read" when transitioning to implementation.
Steps to Reproduce
- Enter plan mode on a non-trivial task requiring reading 5+ files
- Let Claude explore the codebase and write a plan
- Accept the plan and choose "Yes, clear context"
- Observe that Claude re-reads every file it read during planning before it can make any edits
Impact
- Wastes tokens and wall-clock time on redundant file reads
- On larger tasks, re-reads can consume 30-50% of early implementation phase tokens
- Makes the "clear context" acceptance option feel like a penalty rather than a benefit — users want to reclaim context space but pay for it with redundant work
Related Issues
- #24686 — Plan itself lost after compaction (different: about plan content, not file-read records)
- #29890 — General context compaction losing working knowledge (broader scope)
Claude Model
Opus
Is this a regression?
No — this has been the behavior since plan mode was introduced
Claude Code Version
2.3.0 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Ghostty
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗