feature request: option to suppress edit rejection due to "File has not been read"
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 11 comments · opened Jul 3, 2025 · closed Feb 7, 2026
Even if the exact file path and content is included in the prompt, Claude code will still have to read the file before it's allowed to edit it.
It will be great if this behavior can be disabled somehow (either entirely or on a per-prompt basis), which can reduce unnecessary iterations and speed things up.
11 Comments
Hey, that's a great point. I've run into this as well, and it can definitely feel like an unnecessary extra step, especially when you're confident about the change you want to make.
From my understanding of how these agentic systems work, that "read before edit" step is a safety and verification mechanism. It ensures Claude has the most up-to-date version of the file before applying changes, preventing it from overwriting something that might have changed since the context was last loaded. It's a feature to ensure correctness, but I totally get how it slows down the workflow.
As far as I can tell from the documentation, there isn't a direct setting or flag to disable this specific behavior. It seems to be a core part of the agent's logic loop.
However, I've had some success with a couple of workarounds that encapsulate this logic into a single command from my end, which might achieve the speed you're looking for.
Workaround 1: Create a Custom "Force Edit" Slash Command
This has been the most effective method for me. You can create a custom slash command that takes the file path as an argument and is primed to accept new content immediately. This still performs the read/write cycle, but it automates it into a single, reusable command.
In your project, create a file named
.claude/commands/force-edit.md.This prompt instructs Claude to perform the sequence of actions you want. The
$ARGUMENTSplaceholder will be replaced by the file path you provide.``
markdown@$ARGUMENTS`.---
description: "Reads a file then replaces its content with the text provided in the next user message."
argument-hint: "[file_path]"
allowed-tools: Read, Write
---
I need to perform a direct edit on the file located at
My plan is as follows:
Readtool to confirm the file exists and load its current state.Please provide the full, new content for the file now.
```
Now, when you want to do a quick replacement, you can just run your command and paste the new content.
``
``> /force-edit src/components/Button.tsx
Claude will respond based on your command's prompt, and you can immediately paste the new file content and hit enter. It streamlines the whole interaction into one user-initiated sequence.
You can find more info on this in the Slash Commands documentation.
Workaround 2: Use a Specialized Sub-Agent
This is a slightly more advanced approach. You could create a sub-agent specifically for this kind of task.
/agentsand create a new project-level agent calledquick-editor.descriptionlike: "A sub-agent that quickly replaces the content of a file."> use the quick-editor to replace the content of main.py with the following: ...This isolates the context and makes the instruction clear, though it's a bit more verbose to type out. More details are in the Subagents documentation.
It would be a cool feature to have a
--forceor similar flag for theEdittool, but hopefully, these workarounds can help speed up your workflow in the meantime@chrislloyd
Hello Anthropic Claude Code Team! Our team uses a Custom MCP Tool for reading files, and we would like to see this option to allow the agent to edit files without reading them (since the files have ALREADY been read).
🙏🙏🙏
I don't know if this is truly a feature request or a bug fix. I'm more leaning towards bug -- files have actually been read when they are provided in context.
I've also noticed it will sometimes edit the file fine once, and the second time fail. In 'thinking' it says:
I already read the main.go file earlier, but the system is saying I need to read it again. Let me re-read it.This is causing a LOT of waste and means I cannot process full refactors successfully.
Yeah i would love for this to be fixed or have an option to disable it, it makes it difficult to do pre-emptive context optimisations when using agent sdk for example
@chrislloyd Any updates pls?!
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Unstale
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.