Claude Code Edit Tool No Longer Requires a Separate Read After grep
Claude Code v2.1.160 removes a friction point in the edit workflow: running a single-file grep, egrep, or fgrep command now satisfies the read-before-edit requirement. Previously, Claude was required to call the Read tool explicitly before being allowed to edit a file, even when it had already examined the file's contents via grep. The change eliminates redundant tool calls in the common pattern of searching a file and then editing it.
Sources & Mentions
4 external resources covering this update
Edit After grep Now Works Without an Extra Read Call
Claude Code enforces a read-before-edit check: before the Edit tool can modify a file, Claude must have read that file's contents. This safeguard ensures Claude is working from an accurate view of the current file state rather than editing from memory or partial context.
In practice, however, Claude frequently finds the content it needs via grep, searching for a function name, a pattern, or a variable definition, and then attempts to edit the same file. Before v2.1.160, this search did not satisfy the read-before-edit check, forcing an additional Read tool call that was effectively redundant: Claude had already seen the relevant lines.
What Changed
Starting with v2.1.160, a single-file grep, egrep, or fgrep command now counts as satisfying the read-before-edit requirement for that file. Claude can search for content in a file and immediately edit it without an intermediate Read call.
The change applies specifically to single-file invocations. Multi-file or recursive grep searches do not satisfy the check, since they do not guarantee that Claude has seen the specific file it intends to edit.
Why It Matters
For users watching Claude work through multi-step tasks, this change reduces the number of visible tool calls during common search-and-edit operations. Fewer tool calls means faster task completion and less noise in the tool activity log. For users running Claude in headless or SDK mode, it reduces API round-trips in patterns that previously required an extra Read step.
The change was a community-requested improvement: a GitHub issue specifically requesting this behavior had accumulated significant interest from developers who observed Claude making unnecessary Read calls after grepping files.