[Feature] Allow Edit after Grep without requiring Read first
Resolved 💬 2 comments Opened Feb 11, 2026 by VagnerVit Closed Mar 12, 2026
Problem
The Edit tool requires that a file has been Read before editing. However, Claude frequently uses Grep to find and view file content, which provides sufficient context to make edits. Despite this, Edit rejects the operation because only Read (not Grep) satisfies the "file has been read" precondition.
This leads to a frustrating pattern:
- Claude uses Grep to find relevant code (sees the content)
- Claude attempts Edit → fails because file wasn't Read
- Claude has to call Read on the same file just to satisfy the check
- Claude then repeats the Edit
This wastes a tool call and slows down the workflow.
Proposed Solution (in order of preference)
- Allow Grep to satisfy the Edit precondition — if Claude has seen file content via Grep (especially with context lines), it should be able to edit that file directly.
- If that's not feasible: Make the model behavior smarter — when Claude knows content only from Grep, it should automatically call Read before Edit instead of attempting a failing Edit.
Environment
- Claude Code version: 2.1.39
- OS: Windows 11
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗