Write tool should auto-read files instead of requiring explicit read first
Write tool should auto-read files instead of requiring explicit read first
Description
Currently, when using the write tool on an existing file, Claude Code shows the error "File has not been read yet. Read it first before writing to it." This creates unnecessary friction in the workflow.
Expected Behavior
The write tool should automatically read the target file's current contents before writing, eliminating the need for a separate read step.
Current Behavior
Users must explicitly read a file before writing to it, even for simple edits or updates.
Proposed Solution
When the write tool encounters an existing file that hasn't been read in the current session, it should:
- Automatically read the current file contents
- Proceed with the write operation
- Optionally log that it auto-read the file for transparency
This would streamline common workflows like updating configuration files, making targeted edits, or appending to existing files without breaking the user's flow.
---
(un)Fortunately, humans don't get blocked by 'context not loaded' errors when submitting github issues!
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗