native-edits
Every file change goes through Edit or Write, so it shows as a diff and /rewind can undo it.
Install
/plugin marketplace add padezhnov/claude-code-mods /plugin install native-edits@padezhnov - Version
- 0.1.2
- License
- MIT
- Needs Claude Code
- 2.1.287+
- Works in
- terminal · desktop app · VS Code
The problem
In auto mode Claude Code tells the model to make “small, mechanical file changes with sed, heredocs, or short scripts” instead of its own file tools. Changes made that way leave no diff, /rewind cannot undo them, and they skip the path rules and nested CLAUDE.md files that Edit and Write load. On my own machines about half of all local file changes went through the shell.
Before and after
$ sed -i 's/red/blue/' config.txt
The file changes quietly. No diff, nothing for /rewind to undo.
Edit config.txt - color = red + color = blue
A diff in the transcript. /rewind brings the old line back.
How it works
- 01 Rewrites the one sentence of Claude Code’s auto-mode note that asks for shell edits, before the model reads it. Reading and searching through Bash stays.
- 02 If Claude still writes a project file through Bash, the command is not run. Claude is told which file and which tool to use instead. You are never asked.
- 03 If Claude has no Edit or Write tool in the session, the write runs, so nothing gets stuck.
Settings
Change them in /plugin → configure.
Scratch files in /tmp, logs and build output, anything run on another machine (ssh, scp, rsync, docker exec), program output such as git diff > x.patch, and paths you list in allowPaths.
-
modedeny · warn · off - deny refuses shell writes, warn runs them and tells Claude afterwards.
-
scopeproject · everywhere - Which files count.
-
allowPathsglobs - Always allowed. Default: logs, node_modules, dist, build.
-
rewritePrompton · off - Whether to rewrite the auto-mode note.
Replayed against 20,197 Bash commands from my own sessions: 2,090 would have been refused. Of 60 refusals checked by hand, 59 were plain edits written through the shell.
FAQ
Does native-edits work in VS Code?+
Yes. Its hooks run in the VS Code extension, the terminal and the desktop app. VS Code does not show the plugin’s notifications, so you see the effect in Claude’s reply: it edits with Edit and you get a diff.
Will Claude ask me before refusing a command?+
No. The refusal goes straight to Claude with the file name and the tool to use. You only see Claude switch to Edit.
Does it slow down bulk changes?+
A sed -i over fifteen files becomes fifteen Edit calls, which is slower. Set mode to warn or add the path to allowPaths if you prefer speed for those.
Can I still edit files with sed?+
Yes. Outside Claude Code nothing changes. Inside a session, set mode to warn or add the path to allowPaths for files you want changed from the shell.
Which Claude Code version does it need?+
2.1.287 or newer for the guard. The prompt rewrite applies from 2.1.289 and was checked through 2.1.296.