write-guard

Reviewed at commit b3fa839

Steers Claude to Edit instead of rewriting an existing file in full with Write: the first rewrite in a conversation goes through with a one-line note, a later…

Made by
Vedant Andhale
What we checked

When Claude uses Write on an existing file of 2 KB or more, the first such rewrite goes through with a note telling Claude to use Edit next time. A later one is held back once; retrying the same Write goes through. It only checks file size and keeps counts in memory, with no network access or stored data.

Review details

Static review of the source at the pinned commit; not run. Registers tool.call for Write, session.compact and session.end. The Write handler calls $.fs.stat on the target path (metadata only, never file contents) and passes through anything that is missing, not a file or under 2048 bytes. Per loop (main session or sub-agent) the first qualifying rewrite runs normally and a context note is added; the next one for a given file is denied once with a message to use Edit, and a retry of the same Write is allowed. Held-back counts appear via $.ui.status. State lives in in-memory sets and is cleared on compaction (for that loop) and on session end. No network, no process execution, no storage, no model calls, no npm dependencies. Worst effect is one extra denied Write per file that Claude must repeat.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: yes
  • Runs programs on your machine: no
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: no
  • Shows something on screen: yes
Hooked events
Screenshot of write-guard

Steers Claude to Edit instead of rewriting an existing file in full with Write: the first rewrite in a conversation goes through with a one-line note, a later one is held back once; a deliberate retry still goes through.

Made this mod? Add a badge to your README

modsforClaude badge for write-guard

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/write-guard.svg)](https://modsforclaude.com/mods/write-guard/)

← All mods