Write tool should auto-read files instead of requiring explicit read first

Resolved 💬 3 comments Opened Jul 23, 2025 by build000r Closed Aug 19, 2025

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:

  1. Automatically read the current file contents
  2. Proceed with the write operation
  3. 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!

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗