claude-code - 💡(How to fix) Fix Edit tool's "must Read first" rule conflicts with successful-edit hint, causing repeated stalls [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53724Fetched 2026-04-28 06:48:43
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

Root Cause

Long agentic sessions stall repeatedly because the model interprets the post-Edit hint as durable ("don't bother re-reading"), but the harness's actual rule is stricter — Read must be the most recent file-touch tool before each Edit. Hitting this on a multi-edit file is jarring: the model appears to "get stuck" mid-task, requiring user intervention to nudge it past the failure.

Fix Action

Fix / Workaround

Workaround currently in use

RAW_BUFFERClick to expand / collapse

Repro

  1. Edit a file successfully — the system reminder says file state is current in your context — no need to Read it back.
  2. Several tool calls later (or even directly after, if state-tracking expired), Edit the same file again → fails with File has not been read yet. Read it first before writing to it.

Impact

Long agentic sessions stall repeatedly because the model interprets the post-Edit hint as durable ("don't bother re-reading"), but the harness's actual rule is stricter — Read must be the most recent file-touch tool before each Edit. Hitting this on a multi-edit file is jarring: the model appears to "get stuck" mid-task, requiring user intervention to nudge it past the failure.

In a 3+ hour Claude Code session, I observed this same failure mode 6+ times across different files. Each time the user had to interrupt and prompt me to continue, breaking flow.

Asks (in order of preference)

  1. Make the post-Edit state count as a "read" for subsequent edits so a successful Edit satisfies the requirement for the next one too. This is the cheapest fix and matches what the system reminder already implies.
  2. Update the system reminder to say this counts as a read for the NEXT edit only — re-Read before any further edits so the model doesn't generalize incorrectly.
  3. Or: cache file state for N seconds after the last Read/Edit and accept Edits within that window.

Workaround currently in use

Always Read before every Edit, even if the model just edited the file 30 seconds ago. This works but adds 1 round-trip per edit and is easy to forget under sustained agentic load.

Environment

  • Claude Code (CLI) running Opus 4.7 (1M context)
  • Windows 11, Git Bash shell

extent analysis

TL;DR

Update the system to consider a successful Edit as a "read" for subsequent edits, or modify the system reminder to clarify its limitations.

Guidance

  • Consider implementing the first ask: make a successful Edit count as a "read" for the next edit, aligning with the system reminder's implication.
  • If the above is not feasible, update the system reminder to clearly state that the post-Edit state only counts as a "read" for the next edit, to prevent model misinterpretation.
  • Evaluate the third ask: caching file state for a short period after the last Read/Edit, to accept Edits within that window without requiring an additional Read.

Example

No code snippet is provided as the issue does not contain specific code references.

Notes

The current workaround of always Reading before every Edit, although effective, introduces additional latency and may be prone to being forgotten under heavy load.

Recommendation

Apply workaround: Always Read before every Edit, as it is the most straightforward method to ensure compatibility with the current system rules, despite its drawbacks, until a more integrated solution can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Edit tool's "must Read first" rule conflicts with successful-edit hint, causing repeated stalls [2 comments, 2 participants]